I am experimenting quite a strange behaviour in my Android app and have not been able to find a solution in Stackoverflow or whatever place.
I have an Android application working properly with no error when loaded from Eclipse to the mobile phone. But when signed I am seeing this errors in Logcat:
E/DatabaseUtils(2360): Writing exception to parcel
E/DatabaseUtils(2360): java.lang.SecurityException: Permission Denial: get/set setting for user asks to run as user -2 but is calling from user 0; this requires android.permission.INTERACT_ACROSS_USERS_FULL
E/DatabaseUtils(2360): at com.android.server.am.ActivityManagerService.handleIncomingUser(ActivityManagerService.java:13140)
E/DatabaseUtils(2360): at android.app.ActivityManager.handleIncomingUser(ActivityManager.java:2038)
E/DatabaseUtils(2360): at com.android.providers.settings.SettingsProvider.callFromPackage(SettingsProvider.java:607)
E/DatabaseUtils(2360): at android.content.ContentProvider$Transport.call(ContentProvider.java:279)
E/DatabaseUtils(2360): at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:273)
E/DatabaseUtils(2360): at android.os.Binder.execTransact(Binder.java:388)
E/DatabaseUtils(2360): at dalvik.system.NativeStart.run(Native Method)
and after that:
E/Parcel(2360): Class not found when unmarshalling: com.meapp.utilites.Anuncio
E/Parcel(2360): java.lang.ClassNotFoundException: com.meapp.utilites.Anuncio
E/Parcel(2360): at java.lang.Class.classForName(Native Method)
E/Parcel(2360): at java.lang.Class.forName(Class.java:204)
E/Parcel(2360): at java.lang.Class.forName(Class.java:169)
E/Parcel(2360): at android.os.Parcel.readParcelableCreator(Parcel.java:2091)
E/Parcel(2360): at android.os.Parcel.readParcelable(Parcel.java:2055)
E/Parcel(2360): at android.os.Parcel.readValue(Parcel.java:1971)
E/Parcel(2360): at android.os.Parcel.readMapInternal(Parcel.java:2255)
E/Parcel(2360): at android.os.Bundle.unparcel(Bundle.java:223)
E/Parcel(2360): at android.os.Bundle.getString(Bundle.java:1082)
E/Parcel(2360): at android.content.Intent.getStringExtra(Intent.java:4961)
E/Parcel(2360): at com.android.server.am.ActivityStack.startActivityLocked(ActivityStack.java:3761)
E/Parcel(2360): at com.android.server.am.ActivityStack.startActivityMayWait(ActivityStack.java:4977)
E/Parcel(2360): at com.android.server.am.ActivityManagerService.startActivityAsUser(ActivityManagerService.java:3173)
E/Parcel(2360): at com.android.server.am.ActivityManagerService.startActivity(ActivityManagerService.java:3129)
E/Parcel(2360): at android.app.ActivityManagerNative.onTransact(ActivityManagerNative.java:157)
E/Parcel(2360): at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:2125)
E/Parcel(2360): at android.os.Binder.execTransact(Binder.java:388)
E/Parcel(2360): at dalvik.system.NativeStart.run(Native Method)
E/Parcel(2360): Caused by: java.lang.NoClassDefFoundError: com/meapp/utilites/Anuncio
E/Parcel(2360): ... 18 more
E/Parcel(2360): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.meapp.utilites.Anuncio" on path: .
E/Parcel(2360): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:64)
E/Parcel(2360): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
E/Parcel(2360): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
E/Parcel(2360): ... 18 more
I am using proguard with my application and I added these lines to ensure that com.meapp.utilites.Anuncio is visible:
-keep class com.meapp.utilites.** { *; }
-keep class * implements android.os.Parcelable { *; }
-keep public class com.meapp.utilites.Anuncio
com.meapp.utilites.Anuncio implements Parcelable.
But the most extrange thing to me is that even after a ClassNotFoundException not "catched" the app works properly. Even more, the app is doing it work like the Parcelable was recovered without problems because it uses the data contained in that object.
So I have a couple of questions:
Why is giving me a Permission denial in my signed application but there's not problem in the unsigned one?
Why not is crashing my app after a ClassNotFound...?
Why is working properly but announcing that error?
How can I solve this and make proguard make my class visible?
Thanks for your help, I think this a question for Android Ninjas...
I had this problem 6 months ago so I had to search in bitbucket to see what I changed to make it work.
What I did was change my script proguard-project.txt using this template as a base:
# Basic Template extracted from http://wiebe-elsinga.com/blog/obfuscating-for-android-with-proguard/
-dontpreverify
-repackageclasses ''
-allowaccessmodification
-optimizations !code/simplification/arithmetic
-keepattributes *Annotation*
-keep public class * extends android.app.Activity
-keep public class * extends android.app.Application
-keep public class * extends android.app.Service
-keep public class * extends android.content.BroadcastReceiver
-keep public class * extends android.content.ContentProvider
-keep public class * extends android.view.View {
public <init>(android.content.Context);
public <init>(android.content.Context, android.util.AttributeSet);
public <init>(android.content.Context, android.util.AttributeSet, int);
public void set*(...);
}
-keepclasseswithmembers class * {
public <init>(android.content.Context, android.util.AttributeSet);
}
-keepclasseswithmembers class * {
public <init>(android.content.Context, android.util.AttributeSet, int);
}
-keepclassmembers class * implements android.os.Parcelable {
static android.os.Parcelable$Creator CREATOR;
}
-keepclassmembers class **.R$* {
public static <fields>;
}
You can find more info in http://wiebe-elsinga.com/blog/obfuscating-for-android-with-proguard/
As you can see, related to the Parcelable, my original script missed some part of the configuration:
-keepclassmembers class * implements android.os.Parcelable {
static android.os.Parcelable$Creator CREATOR;
}
I hope this helps to all of you @AtulOHolic & @OneWay
android.permission.INTERACT_ACROSS_USERS_FULL is a signature level permission. Your app will not be able to use it until and unless it has the same signature as the system.
class not found may be due to package problem , make sure that you have given same package name of launching activity as of package name.
hope this will help
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