From 6d19df4b9831ee52e9b653db732af3ce25534a73 Mon Sep 17 00:00:00 2001 From: Eric House Date: Sat, 4 Apr 2020 19:36:46 -0700 Subject: [PATCH 1/2] tweaks for logging/debuggin --- .../app/src/main/java/org/eehouse/android/xw4/BTService.java | 2 +- xwords4/android/app/src/main/res/values/strings.xml | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BTService.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BTService.java index e9b35792b..4d583bb4f 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BTService.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BTService.java @@ -261,7 +261,7 @@ public class BTService extends XWJIService { public static void onACLConnected( Context context ) { - Log.d( TAG, "onACLConnected()" ); + Log.d( TAG, "onACLConnected(); enqueuing work" ); enqueueWork( context, getIntentTo( context, BTAction.ACL_CONN ) ); } diff --git a/xwords4/android/app/src/main/res/values/strings.xml b/xwords4/android/app/src/main/res/values/strings.xml index e0d7e1a41..fbe41ac94 100644 --- a/xwords4/android/app/src/main/res/values/strings.xml +++ b/xwords4/android/app/src/main/res/values/strings.xml @@ -2394,7 +2394,8 @@ Notify when Android\'s slow to process outgoing invitations and moves Message sending is stalled - %1$s could not send outbound messages for %2$d seconds. + %1$s (and others?) could not send outbound messages + for %2$d seconds. \n \nIf it happens again, e-mail the developer logs and info about your device. \n From 254443a549ad5a99df7863b54bf721f7b77d4412 Mon Sep 17 00:00:00 2001 From: Eric House Date: Sat, 4 Apr 2020 20:01:52 -0700 Subject: [PATCH 2/2] upgrade to latest gradle version Required redoing how I invoke the NDK. The limititations I had to hack around before seem fixed, so this is probably better. But there will be glitches. :-) --- xwords4/android/app/build.gradle | 138 +++++++----------- .../app/src/main/res/layout/lookup.xml | 2 +- xwords4/android/build.gradle | 2 +- .../gradle/wrapper/gradle-wrapper.properties | 4 +- xwords4/common/comms.h | 4 - 5 files changed, 54 insertions(+), 96 deletions(-) diff --git a/xwords4/android/app/build.gradle b/xwords4/android/app/build.gradle index 730d3986f..0fd4aee24 100644 --- a/xwords4/android/app/build.gradle +++ b/xwords4/android/app/build.gradle @@ -8,19 +8,6 @@ def BUILD_INFO_NAME = "build-info.txt" // each other def XW_UUID = '"7be0d084-ff89-4d6d-9c78-594773a6f963"' // from comms.h def XWD_UUID = '"b079b640-35fe-11e5-a432-0002a5d5c51b"' // from comms.h -def BT_UUIDS = [ - 'xw4fdroidDebug' : XW_UUID, - 'xw4fdroidRelease' : XW_UUID, - 'xw4NoSMSDebug' : XW_UUID, - 'xw4NoSMSRelease' : XW_UUID, - 'xw4SMSDebug' : XW_UUID, - 'xw4SMSRelease' : XW_UUID, - - 'xw4dRelease' : XWD_UUID, - 'xw4dDebug' : XWD_UUID, - 'xw4dNoSMSRelease' : XWD_UUID, - 'xw4dNoSMSDebug' : XWD_UUID, -] // AID must start with F (first 4 bits) and be from 5 to 16 bytes long def NFC_AID_XW4 = "FC8FF510B360" @@ -55,7 +42,8 @@ repositories { android { // Specify buildToolsVersion so gradle will inform when the // default changes and .travis.yml can be kept in sync - buildToolsVersion '27.0.3' + buildToolsVersion '28.0.3' + ndkVersion '21.0.6113669' defaultConfig { // HostApduService requires 19. But is it a problem? minSdkVersion 14 @@ -113,6 +101,8 @@ android { buildConfigField "int", "VARIANT_CODE", "1" buildConfigField "String", "NFC_AID", "\"${NFC_AID_XW4}\"" resValue "string", "nfc_aid", "$NFC_AID_XW4" + externalNativeBuild.ndkBuild.cFlags += ['-DVARIANT_xw4NoSMS'] + externalNativeBuild.ndkBuild.arguments += ['XW_BT_UUID=' + XW_UUID] } xw4fdroid { @@ -128,6 +118,8 @@ android { buildConfigField "boolean", "FOR_FDROID", "true" buildConfigField "String", "NFC_AID", "\"${NFC_AID_XW4}\"" resValue "string", "nfc_aid", "$NFC_AID_XW4" + externalNativeBuild.ndkBuild.cFlags += ['-DVARIANT_xw4fdroid'] + externalNativeBuild.ndkBuild.arguments += ['XW_BT_UUID=' + XW_UUID] } xw4d { dimension "variant" @@ -144,6 +136,8 @@ android { buildConfigField "String", "KEY_FCMID", "\"FBMService_fcmid1\"" buildConfigField "String", "NFC_AID", "\"${NFC_AID_XW4d}\"" resValue "string", "nfc_aid", "$NFC_AID_XW4d" + externalNativeBuild.ndkBuild.cFlags += ['-DVARIANT_xw4d'] + externalNativeBuild.ndkBuild.arguments += ['XW_BT_UUID=' + XWD_UUID] } xw4dNoSMS { @@ -160,6 +154,8 @@ android { buildConfigField "boolean", "REPORT_LOCKS", "true" buildConfigField "String", "NFC_AID", "\"${NFC_AID_XW4d}\"" resValue "string", "nfc_aid", "$NFC_AID_XW4d" + externalNativeBuild.ndkBuild.cFlags += ['-DVARIANT_xw4dNoSMS'] + externalNativeBuild.ndkBuild.arguments += ['XW_BT_UUID=' + XWD_UUID] } xw4SMS { @@ -174,6 +170,8 @@ android { buildConfigField "int", "VARIANT_CODE", "5" buildConfigField "String", "NFC_AID", "\"${NFC_AID_XW4}\"" resValue "string", "nfc_aid", "$NFC_AID_XW4" + externalNativeBuild.ndkBuild.cFlags += ['-DVARIANT_xw4SMS'] + externalNativeBuild.ndkBuild.arguments += ['XW_BT_UUID=' + XW_UUID] } // WARNING: "all" breaks things. Seems to be a keyword. Need @@ -210,12 +208,21 @@ android { } buildTypes { + all { + externalNativeBuild { + ndkBuild.arguments += ["INITIAL_CLIENT_VERS=" + INITIAL_CLIENT_VERS] + } + } + release { debuggable false minifyEnabled false // PENDING // proguard crashes when I do this (the optimize part) // proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' resValue "bool", "DEBUG", "false" + externalNativeBuild { + ndkBuild.arguments += ['BUILD_TARGET=release'] + } } debug { debuggable true @@ -224,6 +231,19 @@ android { proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' // This doesn't work on marshmallow: duplicate permission error // applicationIdSuffix ".debug" + + externalNativeBuild { + ndkBuild { + cFlags += ['-DDEBUG'] + arguments += ['BUILD_TARGET=debug'] + } + } + } + } + + externalNativeBuild { + ndkBuild { + path "../jni/Android.mk" } } @@ -330,23 +350,11 @@ task cleanLocStrings(type: Exec) { } clean.dependsOn cleanLocStrings -task ndkSetupDebug(type: Exec) { - workingDir '../' - // remove ', "--arm-only"' for Genymotion builds - - // I'm putting ARM back for a while. It's too much trouble having - // builds, including those built by travis, that don't run on the - // emulator. Maybe remove this change before each release? - commandLine "./scripts/ndksetup.sh", "--with-clang" - // commandLine "./scripts/ndksetup.sh", "--with-clang", "--arm-only" -} - -task ndkSetupRelease(type: Exec) { - workingDir '../' - commandLine "./scripts/ndksetup.sh", "--with-clang", "--arm-only" -} - -task myPreBuild(dependsOn: ['mkImages', 'copyLocStrings', 'mkXml']) { +task myPreBuild(dependsOn: ['mkImages', + 'copyLocStrings', + 'mkXml', + 'copyStringsXw4D', + 'copyStringsXw4DNoSMS']) { } preBuild.dependsOn myPreBuild @@ -357,64 +365,18 @@ task mkXml(type: Exec) { '-t', "debug" } -afterEvaluate { - ArrayList cleanCmdLst = new ArrayList<>(["rm", "-rf"]) - android.applicationVariants.all { variant -> - // print "variant: " + variant.name + "\n" - String BUILD = variant.getBuildType().getName() - // println "type: " + BUILD - String FLAVOR = variant.getFlavorName() - // print "flavor: " + variant.getFlavorName() + "\n" - // print "variant: " + variant + "\n" +task copyStringsXw4D(type: Exec) { + workingDir './' + environment.put('APPNAME', 'CrossDbg') + commandLine 'make', '-f', '../scripts/Variant.mk', + "src/xw4d/res/values/strings.xml" +} - String ndkSetup = "ndkSetup" + BUILD.capitalize() - // println "ndkSetup: " + ndkSetup - - String variantCaps = variant.name.capitalize() - String nameLC = variant.getBuildType().getName().toLowerCase() - String lib = "libs-${variant.name}" - String ndkBuildTask = "ndkBuild${variantCaps}" - String btUUID = BT_UUIDS[variant.name] - task "$ndkBuildTask"(type: Exec) { - workingDir '../' - commandLine './scripts/ndkbuild.sh', '-j3', - "BUILD_TARGET=${nameLC}", "INITIAL_CLIENT_VERS=$INITIAL_CLIENT_VERS", - "VARIANT=${FLAVOR}", "NDK_LIBS_OUT=${lib}", - "NDK_OUT=./obj-${variant.name}", "XW_BT_UUID=\"${btUUID}\"" - } - - String compileTask = "compile${variantCaps}Ndk" - tasks.getByName(ndkBuildTask).dependsOn ndkSetup - tasks.getByName(compileTask).dependsOn ndkBuildTask - - // For clean task - cleanCmdLst.add("libs-${variant.name}") - cleanCmdLst.add("./obj-${variant.name}") - } - - task cleanNDK(type: Exec) { - workingDir '../' - commandLine cleanCmdLst - } - clean.dependsOn 'cleanNDK' - - String copyStringsTask = "copyStringsXw4D" - task "$copyStringsTask"(type: Exec) { - workingDir './' - environment.put('APPNAME', 'CrossDbg') - commandLine 'make', '-f', '../scripts/Variant.mk', - "src/xw4d/res/values/strings.xml" - } - preBuild.dependsOn copyStringsTask - - String copyStringsTaskNoSMS = "copyStringsXw4DNoSMS" - task "$copyStringsTaskNoSMS"(type: Exec) { - workingDir './' - environment.put('APPNAME', 'CrossDbg') - commandLine 'make', '-f', '../scripts/Variant.mk', - "src/xw4dNoSMS/res/values/strings.xml" - } - preBuild.dependsOn copyStringsTaskNoSMS +task copyStringsXw4DNoSMS(type: Exec) { + workingDir './' + environment.put('APPNAME', 'CrossDbg') + commandLine 'make', '-f', '../scripts/Variant.mk', + "src/xw4dNoSMS/res/values/strings.xml" } task makeBuildAssets() { diff --git a/xwords4/android/app/src/main/res/layout/lookup.xml b/xwords4/android/app/src/main/res/layout/lookup.xml index 1a3733291..4375ef1c8 100644 --- a/xwords4/android/app/src/main/res/layout/lookup.xml +++ b/xwords4/android/app/src/main/res/layout/lookup.xml @@ -13,7 +13,7 @@ android:paddingLeft="8dp" /> -