I've been maintaining an app for a friend's company for several years. When they recently updated from Android 5 to Android 7, the app stopped working. So I ported to Android Studio and started fixing stuff. Now, after squashing a bunch of bugs, I can't get the app to install on my test phone, which is a Pixel XL running Android 8. It was running debug images until I uninstalled it so I could test the install. (I think that was because of Instant Run.)
Now I get the following:
$ adb install-multiple -r -t I:\Users\...\app\build\intermediates\split-apk\debug\slices\slice_0.apk I:\Users\...\app\build\intermediates\split-apk\debug\slices\slice_1.apk I:\Users\...\app\build\intermediates\split-apk\debug\slices\slice_7.apk I:\Users\...\app\build\intermediates\split-apk\debug\slices\slice_4.apk I:\Users\...\app\build\intermediates\split-apk\debug\slices\slice_5.apk I:\Users\...\app\build\intermediates\split-apk\debug\dep\dependencies.apk I:\Users\...\app\build\intermediates\split-apk\debug\slices\slice_6.apk I:\Users\...\app\build\intermediates\split-apk\debug\slices\slice_3.apk I:\Users\...\app\build\intermediates\split-apk\debug\slices\slice_8.apk I:\Users\...\app\build\intermediates\split-apk\debug\slices\slice_2.apk I:\Users\...\app\build\intermediates\split-apk\debug\slices\slice_9.apk I:\Users\...\app\build\outputs\apk\debug\app-debug.apk
Split APKs installed
$ adb shell am start -n "com.pbs.deliverytrack1/com.pbs.deliverytrack1.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -D
Error while executing: am start -n "com.pbs.deliverytrack1/com.pbs.deliverytrack1.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -D
Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.pbs.deliverytrack1/.MainActivity }
Error type 3
Error: Activity class {com.pbs.deliverytrack1/com.pbs.deliverytrack1.MainActivity} does not exist.
Error while Launching activity
Does com.pbs.deliverytrack1/com.pbs.deliverytrack1.MainActivity look correct?
ADDITIONAL NOTES: I was able to get the apk to install over email on a Samsung Edge 7.0 running Nougat 7.0. I'm still unable to get it to install on my Google Pixel XL which is running Oreo 8.0.
I've tried about every combination of build versions I can think of. The key, I think is in the error message:
$ adb shell am start -n "com.pbs.deliverytrack1/com.pbs.deliverytrack1.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -D
Error while executing: am start -n "com.pbs.deliverytrack1/com.pbs.deliverytrack1.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -D
Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.pbs.deliverytrack1/.MainActivity }
Error type 3
Error: Activity class {com.pbs.deliverytrack1/com.pbs.deliverytrack1.MainActivity} does not exist.
In the section that says: cmp=com.pbs.deliverytrack1/.MainActivity, should that be com.pbs.deliverytrack1/com.pbs.deliverytrack1.MainActivity?
UPDATE After messing around with the minSDK, maxSDK, and targetSDK, as well as three different versions of Android: 7.0, 7.1.1, and 8.0, I've found a way to continue working. My client is using 7.0 and 7.1.1, so I built an emulator running 7.0 that I've been using to debug my application. (My wife's suggestion, actually.) So I'm moving forward again.
I'm also going to do what I usually do when dealing with freaky problems. I'm going to go through with -XLint and fix every warning I can find. (When you can't fix the bug you want, baby, fix the bug you got.) Besides cleaning up some long outstanding problems, I'm hoping it will eventually lead to the squashing of this bug.
Thank you to everyone for the help and suggestions. I'll leave this open for a bit, to see if someone comes up with a miracle. I'd prefer to award the bounty than just let it go into the bit bucket. :)
So, once again, I humbly ask for help. Thanks, Ray
Like CommonsWare mentioned in the comment, it looks like your app is installing, it's just unable to be started. I can think of two things to check on:
AndroidManifest.xml
file lists the correct fully qualified class name of the MainActivity
. If it's incorrect, then your app will install, but it will crash when starting and complain about not being able to find your MainActivity
.MainActivity
class from your APK. Many developers only ProGuard their non-debug builds and you mentioned your debug builds work fine, so that might be a hint.applicationId
in your debug
buildType
, then you'd need to specify the same ID in your adb am start
command.Now there are lot of changes in Android and also in Android-8
, Android-7.1
and Android-7
So there are lot of new things in it if you are using background service than you have to add extra Job scheduling
for Android 7,7.1,8
Nougat Behavior change
Oreo Behavior change
Update Android SDK Build-Tools 27.0.1
You can Change Module app Gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.1"
defaultConfig {
applicationId "com.example.package"
minSdkVersion 16
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:26.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
}
To Support Emulator
Update the Sdk Android-7,7.1,8. for creating local emulator File Menu -> Setting -> Appearance & Behavior -> System Setting -> Android Sdk
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With