StephenBlackWasAlreadyTaken / NightWatch

A native android Nightscout client with alerts and google wear integration
GNU General Public License v3.0
92 stars 164 forks source link

Can't create APK #99

Open Alkene opened 6 years ago

Alkene commented 6 years ago

When I try and compile the code and build an APK using Android Studio 3.0.1, I get a error message: Error:Unsupported method: BaseConfig.getApplicationIdSuffix(). The version of Gradle you connect to does not support that method. To resolve the problem you can change/upgrade the target version of Gradle you connect to. Alternatively, you can ignore this exception and read other information from the model. If I increase the gradle version to 2.3.2 as seen on this website: https://stackoverflow.com/questions/44546849/unsupported-method-baseconfig-getapplicationidsuffix I can get it to compile, but the app crashes immediately when I try and run the build on my phone. Any suggestions?

AdrianLxM commented 6 years ago

With those changes it compiles and does not crash for me: https://github.com/StephenBlackWasAlreadyTaken/NightWatch/pull/100

seittenj commented 6 years ago

Hi, did you get it working? I'm using studio3 branch but APK is crashing every time at the beginning. I can compile it succesfully. Same result in emulator and in Hardware. Just wondering if there is something wrong in my android studio& setup in general.

Alkene commented 6 years ago

Kind of. After AdrianLxM made the changes I'm able to make a signed APK and install it separate from Android Studio, (via email it to myself and open) and it will run on my phone. But if I try and use USB to put it on phone to use debugging or what not, it crashes every time either in the emulator or by phone. I was able to enter the debugger on my watch by enabling debugging by wifi though. Just can't get into the debugger for the code that is run on the phone.

seittenj commented 6 years ago

I was able to get my own APK working after disabling "Instant run". If instant run was enabled, I got following error: 02-08 00:59:03.843 9771-9771/com.dexdrip.stephenblack.nightwatch E/AndroidRuntime: FATAL EXCEPTION: main Process: com.dexdrip.stephenblack.nightwatch, PID: 9771 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.dexdrip.stephenblack.nightwatch/com.dexdrip.stephenblack.nightwatch.activities.Home}: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String com.activeandroid.TableInfo.getIdName()' on a null object reference at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2724) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2785) at android.app.ActivityThread.-wrap12(ActivityThread.java) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1532) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:163) at android.app.ActivityThread.main(ActivityThread.java:6342) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:880) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:770) Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String com.activeandroid.TableInfo.getIdName()' on a null object reference at com.activeandroid.Model.(Unknown Source) at com.dexdrip.stephenblack.nightwatch.alerts.AlertType.(AlertType.java:0) at com.dexdrip.stephenblack.nightwatch.alerts.AlertType.add_alert(AlertType.java:220) at com.dexdrip.stephenblack.nightwatch.utils.IdempotentMigrations.migrateBGAlerts(IdempotentMigrations.java:46) at com.dexdrip.stephenblack.nightwatch.utils.IdempotentMigrations.performAll(IdempotentMigrations.java:24) at com.dexdrip.stephenblack.nightwatch.activities.Home.onCreate(Home.java:78) at android.app.Activity.performCreate(Activity.java:6847) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2677) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2785)  at android.app.ActivityThread.-wrap12(ActivityThread.java)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1532)  at android.os.Handler.dispatchMessage(Handler.java:102)  at android.os.Looper.loop(Looper.java:163)  at android.app.ActivityThread.main(ActivityThread.java:6342)  at java.lang.reflect.Method.invoke(Native Method)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:880)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:770)