问题
Our app, used to work. The last update published 2 and a half weeks ago when the apk file created and worked properly.
The last 2 days when we are trying to create the apk (signed or not the problem appears), no errors are thrown from Android Studio, but when the apk is going to be installed on the phone, the app is failed to install with an error "App not Installed"
Additionally the following errors are appearing in Android Monitor.
Class not found when unmarshalling: com.android.packageinstaller.InstallFlowAnalytics
java.lang.ClassNotFoundException: com.android.packageinstaller.InstallFlowAnalytics
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:324)
at android.os.Parcel.readParcelableCreator(Parcel.java:2404)
at android.os.Parcel.readParcelable(Parcel.java:2358)
at android.os.Parcel.readValue(Parcel.java:2264)
at android.os.Parcel.readArrayMapInternal(Parcel.java:2614)
at android.os.BaseBundle.unparcel(BaseBundle.java:221)
at android.os.BaseBundle.getString(BaseBundle.java:920)
at android.content.Intent.getStringExtra(Intent.java:6183)
at com.android.server.am.ActivityStackSupervisor.startActivityLocked(ActivityStackSupervisor.java:2706)
at com.android.server.am.ActivityStackSupervisor.startActivityMayWait(ActivityStackSupervisor.java:2171)
at com.android.server.am.ActivityManagerService.startActivityAsUser(ActivityManagerService.java:6359)
at com.android.server.am.ActivityManagerService.startActivity(ActivityManagerService.java:6127)
at android.app.ActivityManagerNative.onTransact(ActivityManagerNative.java:170)
at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:3999)
at android.os.Binder.execTransact(Binder.java:453)
Caused by: java.lang.ClassNotFoundException: com.android.packageinstaller.InstallFlowAnalytics
at java.lang.Class.classForName(Native Method)
at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:324)
at android.os.Parcel.readParcelableCreator(Parcel.java:2404)
at android.os.Parcel.readParcelable(Parcel.java:2358)
at android.os.Parcel.readValue(Parcel.java:2264)
at android.os.Parcel.readArrayMapInternal(Parcel.java:2614)
at android.os.BaseBundle.unparcel(BaseBundle.java:221)
at android.os.BaseBundle.getString(BaseBundle.java:920)
at android.content.Intent.getStringExtra(Intent.java:6183)
at com.android.server.am.ActivityStackSupervisor.startActivityLocked(ActivityStackSupervisor.java:2706)
at com.android.server.am.ActivityStackSupervisor.startActivityMayWait(ActivityStackSupervisor.java:2171)
at com.android.server.am.ActivityManagerService.startActivityAsUser(ActivityManagerService.java:6359)
at com.android.server.am.ActivityManagerService.startActivity(ActivityManagerService.java:6127)
at android.app.ActivityManagerNative.onTransact(ActivityManagerNative.java:170)
at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:3999)
at android.os.Binder.execTransact(Binder.java:453)
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available
Has anyone faced a similar problem?
Thank you in advance.
回答1:
I had a similar issue before while releasing apk, i was not able to install it, that was happening if the signature v2 is checked.
Unfortunately, I am not really sure why it causes such problems! anyway if you checked v2 try to uncheck it and use only v1 (the jar signature).
Also thanks to @codeMagic for providing us with this STO thread about differences between both types.
回答2:
I fixed that the same which mentioned above, by applying v1 signing only and turn off v2 signing, moreover that can be done through gradle
build file by settings value for v1SigningEnabled
& v2SigningEnabled
as the following:
signingConfigs {
staging {
keyAlias *****
keyPassword *****
storeFile file(*****)
storePassword *****
v1SigningEnabled true
v2SigningEnabled false
}
release {
keyAlias *****
keyPassword *****
storeFile file(*****)
storePassword *****
v1SigningEnabled true
v2SigningEnabled false
}
}
来源:https://stackoverflow.com/questions/42889724/apk-cannot-install