LibGDX classes not being found - android

My program is crashing with a
03-05 02:21:57.127: E/dalvikvm(12583): Could not find class 'com.deerandcatgames.spikeJumper.GUI.OuyaTable$1', referenced from method com.deerandcatgames.spikeJumper.GUI.OuyaTable.<init>
Whenever I run it on android, from the desktop project, it runs fine.
I look at the logcat, and I find the following errors:
03-05 02:21:56.907: I/SpikeJumper(12583): Showing screen: SplashScreen
03-05 02:21:56.957: D/dalvikvm(12583): GC_FOR_ALLOC freed 23K, 5% free 7525K/7920K, paused 37ms, total 37ms
03-05 02:21:57.127: W/dalvikvm(12583): Unable to resolve superclass of Lcom/deerandcatgames/spikeJumper/GUI/OuyaTable$1; (347)
03-05 02:21:57.127: W/dalvikvm(12583): Link of class 'Lcom/deerandcatgames/spikeJumper/GUI/OuyaTable$1;' failed
03-05 02:21:57.127: E/dalvikvm(12583): Could not find class 'com.deerandcatgames.spikeJumper.GUI.OuyaTable$1', referenced from method com.deerandcatgames.spikeJumper.GUI.OuyaTable.<init>
03-05 02:21:57.127: W/dalvikvm(12583): VFY: unable to resolve new-instance 992 (Lcom/deerandcatgames/spikeJumper/GUI/OuyaTable$1;) in Lcom/deerandcatgames/spikeJumper/GUI/OuyaTable;
03-05 02:21:57.127: D/dalvikvm(12583): VFY: replacing opcode 0x22 at 0x0016
03-05 02:21:57.127: I/dalvikvm(12583): Could not find method com.badlogic.gdx.controllers.Controllers.removeListener, referenced from method com.deerandcatgames.spikeJumper.GUI.OuyaTable.dispose
03-05 02:21:57.127: W/dalvikvm(12583): VFY: unable to resolve static method 2760: Lcom/badlogic/gdx/controllers/Controllers;.removeListener (Lcom/badlogic/gdx/controllers/ControllerListener;)V
03-05 02:21:57.127: D/dalvikvm(12583): VFY: replacing opcode 0x71 at 0x0007
03-05 02:21:57.127: W/dalvikvm(12583): Unable to resolve superclass of Lcom/deerandcatgames/spikeJumper/GUI/OuyaTable$1; (347)
03-05 02:21:57.127: W/dalvikvm(12583): Link of class 'Lcom/deerandcatgames/spikeJumper/GUI/OuyaTable$1;' failed
03-05 02:21:57.137: D/dalvikvm(12583): DexOpt: unable to opt direct call 0x26b5 at 0x18 in Lcom/deerandcatgames/spikeJumper/GUI/OuyaTable;.<init>
03-05 02:21:57.187: D/dalvikvm(12583): GC_CONCURRENT freed 399K, 8% free 7578K/8236K, paused 3ms+5ms, total 29ms
03-05 02:21:57.257: I/SpikeJumper(12583): Setting up custom table
03-05 02:21:57.257: W/dalvikvm(12583): threadid=11: thread exiting with uncaught exception (group=0x418a3930)
03-05 02:21:57.257: E/AndroidRuntime(12583): FATAL EXCEPTION: GLThread 19356
03-05 02:21:57.257: E/AndroidRuntime(12583): java.lang.NoClassDefFoundError: com.deerandcatgames.spikeJumper.GUI.OuyaTable$1
03-05 02:21:57.257: E/AndroidRuntime(12583): at com.deerandcatgames.spikeJumper.GUI.OuyaTable.<init>(OuyaTable.java:72)
03-05 02:21:57.257: E/AndroidRuntime(12583): at com.deerandcatgames.spikeJumper.screens.AbstractScreen.getTable(AbstractScreen.java:84)
03-05 02:21:57.257: E/AndroidRuntime(12583): at com.deerandcatgames.spikeJumper.screens.AbstractScreen.resize(AbstractScreen.java:52)
03-05 02:21:57.257: E/AndroidRuntime(12583): at com.deerandcatgames.spikeJumper.screens.SplashScreen.resize(SplashScreen.java:49)
03-05 02:21:57.257: E/AndroidRuntime(12583): at com.badlogic.gdx.Game.setScreen(Game.java:63)
03-05 02:21:57.257: E/AndroidRuntime(12583): at com.deerandcatgames.spikeJumper.SpikeJumper.setScreen(SpikeJumper.java:61)
03-05 02:21:57.257: E/AndroidRuntime(12583): at com.deerandcatgames.spikeJumper.SpikeJumper.resize(SpikeJumper.java:79)
03-05 02:21:57.257: E/AndroidRuntime(12583): at com.badlogic.gdx.backends.android.AndroidGraphics.onSurfaceChanged(AndroidGraphics.java:334)
03-05 02:21:57.257: E/AndroidRuntime(12583): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1505)
03-05 02:21:57.257: E/AndroidRuntime(12583): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1240)
The OuyaTable is
public class OuyaTable extends Table {
....
}
I have tried everything I can think of, and it still will not run on the android. Has anyone seen this before, and/or knows how to fix it?

Okay, trying again but paying more attention to the error messages... I see:
Could not find method com.badlogic.gdx.controllers.Controllers.removeListener, referenced from method com.deerandcatgames.spikeJumper.GUI.OuyaTable.dispose
As one of the reasons the link failed. I think you must be using the libgdx "controllers" extension ... you need to add the gdx-controllers-android.jar. See the "Integration Into Your Project" section of the badlogic blog: http://www.badlogicgames.com/wordpress/?p=2724

The gdx.jar (which contains the platform-independent Libgdx classes) probably didn't get packaged into your Android .APK. (Versus the Android-specific Libgdx classes which are packaged in gdx-backend-android.jar and did seem to make it into your .APK.)
You need to make sure your Android project is exporting the gdx.jar. Right-click on your Android project in Project Explorer, select Properties, select Java Build Path, and select the Order and Export tab. Make sure gdx.jar and gdx-backend-android.jar are both "checked" (along with your common project).

java=caca, adt=caca, eclipse=.....
I 've had this problem, solved changing the main project (star-assault in the tutorial) from java 1.7 to java 1.6 after getting mad for couple of hours...

Related

When ran an application in Genymotion i get: "Unfortunately, app has stopped."

I'm looking for a good option to automate my tests in a mobile application. Genymotion looks the best option.
So i installed genymotion, added the arm translation and gapps in the vm, but when i try to open my application i get: "Unfortunately, [app name] has stopped."
Applications such clash of clans and facebook does works, and applications such Uber and Netflix doesnt either. This issue happens in an kit kat emulator. Jelly Bean and ICS looks fine.
Here's what logcat says:
01-07 16:31:04.204 2979-2979/com.psafe.powerpro I/MultiDex﹕ VM with version 1.6.0 does not have multidex support
01-07 16:31:04.204 2979-2979/com.psafe.powerpro I/MultiDex﹕ install
01-07 16:31:04.212 2979-2979/com.psafe.powerpro I/MultiDex﹕ MultiDexExtractor.load(/data/app/com.psafe.powerpro-1.apk, false)
01-07 16:31:04.212 2979-2979/com.psafe.powerpro I/MultiDex﹕ loading existing secondary dex files
01-07 16:31:04.212 2979-2979/com.psafe.powerpro I/MultiDex﹕ load found 0 secondary dex files
01-07 16:31:04.212 2979-2979/com.psafe.powerpro I/MultiDex﹕ install done
01-07 16:31:04.232 2979-2979/com.psafe.powerpro I/dalvikvm﹕ Could not find method android.content.pm.PackageManager.getPackageInstaller, referenced from method gQ.a
01-07 16:31:04.232 2979-2979/com.psafe.powerpro W/dalvikvm﹕ VFY: unable to resolve virtual method 6352: Landroid/content/pm/PackageManager;.getPackageInstaller ()Landroid/content/pm/PackageInstaller;
01-07 16:31:04.232 2979-2979/com.psafe.powerpro D/dalvikvm﹕ VFY: replacing opcode 0x6e at 0x000e
01-07 16:31:04.256 2979-2995/com.psafe.powerpro I/GMPM﹕ App measurement is starting up
01-07 16:31:04.264 2979-2979/com.psafe.powerpro D/dalvikvm﹕ GC_FOR_ALLOC freed 354K, 14% free 3003K/3464K, paused 4ms, total 5ms
01-07 16:31:04.264 2979-2995/com.psafe.powerpro E/GMPM﹕ getGoogleAppId failed with status: 10
01-07 16:31:04.268 2979-2995/com.psafe.powerpro E/GMPM﹕ Uploading is not possible. App measurement disabled
01-07 16:31:04.280 2979-2979/com.psafe.powerpro D/dalvikvm﹕ Trying to load lib /data/data/com.psafe.powerpro/files/libmobilesafe360-jni-2.7.so 0xa50565b0
01-07 16:31:04.308 2979-2979/com.psafe.powerpro A/libc﹕ Fatal signal 11 (SIGSEGV) at 0x000000b4 (code=1), thread 2979 (.psafe.powerpro)
Any toughts about it?

NoClassDefFoundError for .jar library at runtime in Android Studio

Hi Friends at Stack Overflow
I recently run into a problem when implementing Fiksu SDK in my Android app. A brief intro, Fiksu SDK is a marketing tool to register installation and events. All the methods related to Fiksu is in a .jar file called "ASOTracking.jar"
The problem:
The library is setup correctly, there is no error reported by Gradle when project compiles and I can even make debug apk. However, it throws "java.lang.NoClassDefFoundError" at runtime when it tries to initialize the SDK.
The log:
01-27 14:06:54.801 31166-31166/com.example.myapp I/dalvikvm﹕ Could not find method com.fiksu.asotracking.FiksuDeviceSettingsManager.getInstance, referenced from method com.fiksu.asotracking.FiksuTrackingManager.getClientId
01-27 14:06:54.801 31166-31166/com.example.myapp W/dalvikvm﹕ VFY: unable to resolve static method 13738: Lcom/fiksu/asotracking/FiksuDeviceSettingsManager;.getInstance ()Lcom/fiksu/asotracking/FiksuDeviceSettingsManager;
01-27 14:06:54.801 31166-31166/com.example.myapp D/dalvikvm﹕ VFY: replacing opcode 0x71 at 0x0000
01-27 14:06:54.806 31166-31166/com.example.myapp I/dalvikvm﹕ Could not find method com.fiksu.asotracking.FiksuConfigurationManager.getInstance, referenced from method com.fiksu.asotracking.FiksuTrackingManager.initialize
01-27 14:06:54.806 31166-31166/com.example.myapp W/dalvikvm﹕ VFY: unable to resolve static method 13733: Lcom/fiksu/asotracking/FiksuConfigurationManager;.getInstance ()Lcom/fiksu/asotracking/FiksuConfigurationManager;
01-27 14:06:54.806 31166-31166/com.example.myapp D/dalvikvm﹕ VFY: replacing opcode 0x71 at 0x000f
01-27 14:06:54.806 31166-31166/com.example.myapp I/dalvikvm﹕ Could not find method com.fiksu.asotracking.FiksuDeviceSettingsManager.getInstance, referenced from method com.fiksu.asotracking.FiksuTrackingManager.isAppTrackingEnabled
01-27 14:06:54.806 31166-31166/com.example.myapp W/dalvikvm﹕ VFY: unable to resolve static method 13738: Lcom/fiksu/asotracking/FiksuDeviceSettingsManager;.getInstance ()Lcom/fiksu/asotracking/FiksuDeviceSettingsManager;
01-27 14:06:54.806 31166-31166/com.example.myapp D/dalvikvm﹕ VFY: replacing opcode 0x71 at 0x0000
01-27 14:06:54.806 31166-31166/com.example.myapp I/dalvikvm﹕ Could not find method com.fiksu.asotracking.FiksuDeviceSettingsManager.getInstance, referenced from method com.fiksu.asotracking.FiksuTrackingManager.setAppTrackingEnabled
01-27 14:06:54.806 31166-31166/com.example.myapp W/dalvikvm﹕ VFY: unable to resolve static method 13738: Lcom/fiksu/asotracking/FiksuDeviceSettingsManager;.getInstance ()Lcom/fiksu/asotracking/FiksuDeviceSettingsManager;
01-27 14:06:54.806 31166-31166/com.example.myapp D/dalvikvm﹕ VFY: replacing opcode 0x71 at 0x0010
01-27 14:06:54.806 31166-31166/com.example.myapp I/dalvikvm﹕ Could not find method com.fiksu.asotracking.FiksuDeviceSettingsManager.getInstance, referenced from method com.fiksu.asotracking.FiksuTrackingManager.setClientId
01-27 14:06:54.806 31166-31166/com.example.myapp W/dalvikvm﹕ VFY: unable to resolve static method 13738: Lcom/fiksu/asotracking/FiksuDeviceSettingsManager;.getInstance ()Lcom/fiksu/asotracking/FiksuDeviceSettingsManager;
01-27 14:06:54.806 31166-31166/com.example.myapp D/dalvikvm﹕ VFY: replacing opcode 0x71 at 0x0010
01-27 14:06:54.806 31166-31166/com.example.myapp I/dalvikvm﹕ Could not find method com.fiksu.asotracking.FiksuConfigurationManager.getInstance, referenced from method com.fiksu.asotracking.FiksuTrackingManager.setDebugModeEnabled
01-27 14:06:54.806 31166-31166/com.example.myapp W/dalvikvm﹕ VFY: unable to resolve static method 13733: Lcom/fiksu/asotracking/FiksuConfigurationManager;.getInstance ()Lcom/fiksu/asotracking/FiksuConfigurationManager;
01-27 14:06:54.806 31166-31166/com.example.myapp D/dalvikvm﹕ VFY: replacing opcode 0x71 at 0x0001
01-27 14:06:54.806 31166-31166/com.example.myapp E/dalvikvm﹕ Could not find class 'com.fiksu.asotracking.CustomEventTracker', referenced from method com.fiksu.asotracking.FiksuTrackingManager.uploadCustomEvent
01-27 14:06:54.806 31166-31166/com.example.myapp W/dalvikvm﹕ VFY: unable to resolve new-instance 2112 (Lcom/fiksu/asotracking/CustomEventTracker;) in Lcom/fiksu/asotracking/FiksuTrackingManager;
01-27 14:06:54.806 31166-31166/com.example.myapp D/dalvikvm﹕ VFY: replacing opcode 0x22 at 0x000f
01-27 14:06:54.806 31166-31166/com.example.myapp E/dalvikvm﹕ Could not find class 'com.fiksu.asotracking.PurchaseEventTracker', referenced from method com.fiksu.asotracking.FiksuTrackingManager.uploadPurchase
01-27 14:06:54.806 31166-31166/com.example.myapp W/dalvikvm﹕ VFY: unable to resolve new-instance 2125 (Lcom/fiksu/asotracking/PurchaseEventTracker;) in Lcom/fiksu/asotracking/FiksuTrackingManager;
01-27 14:06:54.806 31166-31166/com.example.myapp D/dalvikvm﹕ VFY: replacing opcode 0x22 at 0x0022
01-27 14:06:54.806 31166-31166/com.example.myapp E/dalvikvm﹕ Could not find class 'com.fiksu.asotracking.PurchaseEventTracker', referenced from method com.fiksu.asotracking.FiksuTrackingManager.uploadPurchaseEvent
01-27 14:06:54.806 31166-31166/com.example.myapp W/dalvikvm﹕ VFY: unable to resolve new-instance 2125 (Lcom/fiksu/asotracking/PurchaseEventTracker;) in Lcom/fiksu/asotracking/FiksuTrackingManager;
01-27 14:06:54.806 31166-31166/com.example.myapp D/dalvikvm﹕ VFY: replacing opcode 0x22 at 0x0014
01-27 14:06:54.806 31166-31166/com.example.myapp E/dalvikvm﹕ Could not find class 'com.fiksu.asotracking.RegistrationEventTracker', referenced from method com.fiksu.asotracking.FiksuTrackingManager.uploadRegistration
01-27 14:06:54.806 31166-31166/com.example.myapp W/dalvikvm﹕ VFY: unable to resolve new-instance 2126 (Lcom/fiksu/asotracking/RegistrationEventTracker;) in Lcom/fiksu/asotracking/FiksuTrackingManager;
01-27 14:06:54.806 31166-31166/com.example.myapp D/dalvikvm﹕ VFY: replacing opcode 0x22 at 0x001e
01-27 14:06:54.806 31166-31166/com.example.myapp E/dalvikvm﹕ Could not find class 'com.fiksu.asotracking.RegistrationEventTracker', referenced from method com.fiksu.asotracking.FiksuTrackingManager.uploadRegistrationEvent
01-27 14:06:54.806 31166-31166/com.example.myapp W/dalvikvm﹕ VFY: unable to resolve new-instance 2126 (Lcom/fiksu/asotracking/RegistrationEventTracker;) in Lcom/fiksu/asotracking/FiksuTrackingManager;
01-27 14:06:54.806 31166-31166/com.example.myapp D/dalvikvm﹕ VFY: replacing opcode 0x22 at 0x0010
01-27 14:06:54.806 31166-31166/com.example.myapp D/dalvikvm﹕ DexOpt: unable to opt direct call 0x35ce at 0x2b in Lcom/fiksu/asotracking/FiksuTrackingManager;.initialize
01-27 14:06:54.806 31166-31166/com.example.myapp D/dalvikvm﹕ DexOpt: unable to opt direct call 0x35c5 at 0x2e in Lcom/fiksu/asotracking/FiksuTrackingManager;.initialize
01-27 14:06:54.811 31166-31166/com.example.myapp D/dalvikvm﹕ DexOpt: unable to opt direct call 0x359b at 0x15 in Lcom/fiksu/asotracking/FiksuTrackingManager;.uploadCustomEvent
01-27 14:06:54.811 31166-31166/com.example.myapp D/dalvikvm﹕ DexOpt: unable to opt direct call 0x35cf at 0x30 in Lcom/fiksu/asotracking/FiksuTrackingManager;.uploadPurchase
01-27 14:06:54.811 31166-31166/com.example.myapp D/dalvikvm﹕ DexOpt: unable to opt direct call 0x35cf at 0x23 in Lcom/fiksu/asotracking/FiksuTrackingManager;.uploadPurchaseEvent
01-27 14:06:54.811 31166-31166/com.example.myapp D/dalvikvm﹕ DexOpt: unable to opt direct call 0x35d1 at 0x26 in Lcom/fiksu/asotracking/FiksuTrackingManager;.uploadRegistration
01-27 14:06:54.811 31166-31166/com.example.myapp I/dalvikvm﹕ DexOpt: unable to optimize static field ref 0x1507 at 0x16 in Lcom/fiksu/asotracking/FiksuTrackingManager;.uploadRegistrationEvent
01-27 14:06:54.811 31166-31166/com.example.myapp D/dalvikvm﹕ DexOpt: unable to opt direct call 0x35d1 at 0x19 in Lcom/fiksu/asotracking/FiksuTrackingManager;.uploadRegistrationEvent
01-27 14:06:54.811 31166-31166/com.example.myapp D/AndroidRuntime﹕ Shutting down VM
01-27 14:06:54.811 31166-31166/com.example.myapp W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0x41ecb700)
01-27 14:06:54.821 31166-31166/com.example.myapp E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.NoClassDefFoundError: com.fiksu.asotracking.FiksuConfigurationManager
at com.fiksu.asotracking.FiksuTrackingManager.initialize(FiksuTrackingManager.java:83)
at com.example.userinterface.MyApplication.onCreate(MyApplication.java:56)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1024)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4684)
at android.app.ActivityThread.access$1400(ActivityThread.java:159)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1376)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5419)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1187)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
at dalvik.system.NativeStart.main(Native Method)
My local environment:
Project is developed on Android Studio
I'm using Mac OS X 10.8.5 Mountain Lion
compileSdkVersion 21, buildToolsVersion "21.1.2",
gradleVersion = '2.2.1', com.android.tools.build:gradle:1.0.0
This is a multi-module project. Application module calls "userInterface" library module and this SDK lies in this library module.
What I've tried:
I do make sure the SDK (jar) file is properly setup and there is no compile error reported by Gradle
I make sure there is no syntax error at the places where SDK methods is called
I checked the dependency of the module that calls this SDK to make sure there is no dependency problem. I go so far that I even trim the whole dependency tree (I know it's unnecessary).
I tried deleting the "build" directory of all modules and rebuild the whole project
I performed the "Invalidate Cache/Restart" operation in Android Studio
I performed "./gradlew clean" command via Terminal at both root directory and application module directory.
I consulted the following links in STO with no success:
Android Studio - Importing external Library/Jar
Android Studio: Add jar as library?
Android studio Gradle Could not find method compile()
Getting "Caused by: java.lang.VerifyError:"
Unable to find classes in Android library file
NoClassDefFoundError with libraries in Android Studio
Final thoughts:
I need some serious help because I've tried everything I know. This SDK worked fine before I migrated this project from Eclipse. Now it throws weird exception when running in Android Studio.
There is one last thing that's kinda suspicious --- the classpath file in Android Studio (the ***.imi file), I re-arrange the classpath entries in it and it still doesn't work.
Thank you guys advance for your help!
New Findings
My GS4 (Android 4.3) cannot run this app, but HTC One M8 (Android 5.0.1) can run it
Root Cause
65K methods limit
Refer to this document: https://developer.android.com/tools/building/multidex.html
Basically there is a methods reference limit and the only solution is to use multidex configuration. However there are implementation for platforms prior 5.0 and after 5.0
Solution
The solution is described in both:
https://developer.android.com/tools/building/multidex.html
https://developer.android.com/reference/android/support/multidex/MultiDexApplication.html
For my project, since it supports older version of Android, I go with the "multidex support library" solution.
Set the build tool version of all library modules and app module to the latest 21.1.2
For module that has Application class, add compile 'com.android.support:multidex:1.0.0' as dependency
Refer to this link to modify your application class. https://developer.android.com/reference/android/support/multidex/MultiDexApplication.html
At the same gradle script, under android -> defaultConfig block, add "multiDexEnabled true"
If your system gives "Java Heap Size" error, in the app module's gradle script, add the following
dexOptions {
incremental true
javaMaxHeapSize "4g"
}

Apache Cordova Facebook Plugin (latest version/current master) crashes my android app while initializing

I've created the sample app given in the latest version (current master) of Apache Cordova Facebook Plugin several times:
https://github.com/phonegap/phonegap-facebook-plugin
Currently, I'm working on Android only.
The first time I created this sample app (about two weeks ago) everything worked fine. I successfully logged in with my facebook account, posted a status to my wall and logged out (all the other actions worked fine as well).
But since than I've created this sample app several more times (in the exact same way), and it has never worked again (the last time I tried was today). In the new apps (with the very same code as the first app, which still works), I press "LOGIN WITH FACEBOOK", and my app crashes immediately. Sometimes the app doesn't crash immediately, and I can get the message "Argument 'session' cannot be null". Then I press "LOGIN WITH FACEBOOK" again, and the app crashes. Sometimes I can get this message several times before the app eventually crashes.
If I press "LOGOUT WITH FACEBOOK", I get the message: "No valid session found, must call init and login before logout".
I also don't think that the problem is that I have a wrong hash key or something like that, because I've been careful with the settings of the facebook app every time.
I also believe that I've installed the plugin correctly each time, because I've always done it the same way I did it the first time, which worked fine.
So how is it that in my latest attempts the session variable is NULL??
Why did it work only in the first time??
I'm very frustrated..
Edit:
Here is the relevant segment of the LogCat log:
D/ConnectPlugin( 7064): login FB
W/dalvikvm( 7064): VFY: unable to resolve static field 2130 (com_facebook_internet_permission_error_title) in Lcom/facebook/android/R$string;
D/dalvikvm( 7064): VFY: replacing opcode 0x60 at 0x0010
I/dalvikvm( 7064): DexOpt: unable to optimize static field ref 0x0851 at 0x18 in Lcom/facebook/AuthorizationClient;.checkInternetPermission
W/dalvikvm( 7064): VFY: unable to resolve static field 2120 (com_facebook_login_activity_layout) in Lcom/facebook/android/R$layout;
D/dalvikvm( 7064): VFY: replacing opcode 0x60 at 0x0003
W/dalvikvm( 7064): VFY: unable to resolve static field 2103 (com_facebook_login_activity_progress_bar) in Lcom/facebook/android/R$id;
D/dalvikvm( 7064): VFY: replacing opcode 0x60 at 0x0008
I/ActivityManager( 2112): START {intent.toShortString} from pid 7064
I/power ( 2112): *** acquire_dvfs_lock : lockType : 1 freq : 1000000
D/PowerManagerService( 2112): acquireDVFSLockLocked : type : DVFS_MIN_LIMIT frequency : 1000000 uid : 1000 pid : 2112 tag : ActivityManager
W/ActivityManager( 2112): mDVFSLock.acquire()
D/dalvikvm( 7064): GC_CONCURRENT freed 455K, 6% free 12931K/13639K, paused 4ms+5ms
W/PluginManager( 7064): THREAD WARNING: exec() call to FacebookConnectPlugin.login blocked the main thread for 207ms. Plugin should use CordovaInterface.getThreadPool().
D/CordovaActivity( 7064): Paused the application!
D/CordovaWebView( 7064): Handle the pause
D/FirewallPolicy( 2112): getURLFilterEnabled(true)
D/FirewallPolicy( 2112): isUrlBlocked - Policy disabled
D/webkit ( 7064): Firewall not null
D/FirewallPolicy( 2112): getURLFilterEnabled(true)
D/FirewallPolicy( 2112): isUrlBlocked - Policy disabled
I/ClipboardServiceEx( 2112): mCBPickerDialog enter case. MSG_DISMISS_DIALOG
D/webkit ( 7064): euler: isUrlBlocked = false
D/FirewallPolicy( 2112): getURLFilterEnabled(true)
D/FirewallPolicy( 2112): isUrlBlocked - Policy disabled
D/ActivityManager( 2112): Trying to launch applicationName
D/KeyguardViewMediator( 2112): setHidden false
I/ClipboardServiceEx( 2112): mCBPickerDialog enter case. MSG_DISMISS_DIALOG
D/AndroidRuntime( 7064): Shutting down VM
W/dalvikvm( 7064): threadid=1: thread exiting with uncaught exception (group=0x40c6c1f8)
E/AndroidRuntime( 7064): FATAL EXCEPTION: main
E/AndroidRuntime( 7064): java.lang.NoClassDefFoundError: com.facebook.android.R$layout
E/AndroidRuntime( 7064): at com.facebook.LoginActivity.onCreate(LoginActivity.java:57)
E/AndroidRuntime( 7064): at android.app.Activity.performCreate(Activity.java:4562)
E/AndroidRuntime( 7064): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1053)
E/AndroidRuntime( 7064): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1934)
E/AndroidRuntime( 7064): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1995)
E/AndroidRuntime( 7064): at android.app.ActivityThread.access$600(ActivityThread.java:128)
E/AndroidRuntime( 7064): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1161)
E/AndroidRuntime( 7064): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 7064): at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime( 7064): at android.app.ActivityThread.main(ActivityThread.java:4514)
E/AndroidRuntime( 7064): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 7064): at java.lang.reflect.Method.invoke(Method.java:511)
E/AndroidRuntime( 7064): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:993)
E/AndroidRuntime( 7064): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:760)
E/AndroidRuntime( 7064): at dalvik.system.NativeStart.main(Native Method)
W/ActivityManager( 2112): Force finishing activity com.yomama.test/com.facebook.LoginActivity
W/ActivityManager( 2112): Force finishing activity com.yomama.test/.Test
Another strange thing that happened to me yesterday was that I recompiled and re-installed (on my phone) the first working app, and suddenly it didn't work either (I got the same message after pressing "LOGIN WITH FACEBOOK", and then the app crashed). Then I recompiled and re-installed the app again, and it was working fine again. Weird.
Try the following steps (from this GitHub issue; had worked for me):
+### Android Setup without Eclipse (just CLI)
+Follow the steps above:
cordova create myApp
cd myApp/
cordova platform add android
cordova -d plugin add https://github.com/phonegap/phonegap-facebook-plugin.git --variable APP_ID="123456789" --variable APP_NAME="myApplication"
// add FacebookLib
echo "android.library.reference.2=com.phonegap.plugins.facebookconnect/FacebookLib" >> platforms/android/project.properties
cp platforms/android/local.properties platforms/android/com.phonegap.plugins.facebookconnect/FacebookLib
android update project -p platforms/android/
cd platforms/android/
ant clean
cd com.phonegap.plugins.facebookconnect/FacebookLib
ant clean
open -e AndroidManifest.xml
// change your minSdkVersion and your targetSdkVersion to your environment settings.
ant release
cd ../../../..
cordova build android
With this steps you can add the Plugin without using Eclipse

Issues with Google Play Game Services occupying Android Res folder & Web API alternative?

So we're in the middle of development of our Unity based game for Android. We had Facebook authentication already implemented and this makes use of the Android/Res folder. It stores some values and images there.
While trying to implement Google Play SDK for Authentication, Leaderboards, Achievements.... we came to realize it too makes use of the Android/Res folder which apparently causes a crash and not currently possible.
We're curious about 2 options
1) is there any possible way to allow 2 different services to make use of the Android resource system? Please note we're using Unity, and the plugin is made by Prime31.
If the source for the library is released then it could be possible to modify so the resource folder isn't used.
2) If we're stuck not being able to have Facebook and Google Play Services co-exist then is the entire process possible via REST JSON access? How is the Google+ sign in performed with our app launching a browser or Google+ app to securely take in credentials?
See our error log below
W/PopupManager(11358): You have not specified a View to use as content view for popups. Falling back to the Activity content view which may not work properly in future versions of the API. Use setViewForPopups() to set your content view.W/dalvikvm(11358): VFY: unable to resolve static field 1994 (common_google_play_services_install_title) in Lcom/google/android/gms/R$string;
D/dalvikvm(11358): VFY: replacing opcode 0x60 at 0x0041
W/dalvikvm(11358): VFY: unable to resolve static field 1990 (common_google_play_services_enable_title) in Lcom/google/android/gms/R$string;
D/dalvikvm(11358): VFY: replacing opcode 0x60 at 0x004c
W/dalvikvm(11358): VFY: unable to resolve static field 2000 (common_google_play_services_update_title) in Lcom/google/android/gms/R$string;
D/dalvikvm(11358): VFY: replacing opcode 0x60 at 0x0057
W/dalvikvm(11358): VFY: unable to resolve static field 1997 (common_google_play_services_unsupported_title) in Lcom/google/android/gms/R$string;
D/dalvikvm(11358): VFY: replacing opcode 0x60 at 0x0069
W/dalvikvm(11358): VFY: unable to resolve static field 1991 (common_google_play_services_install_button) in Lcom/google/android/gms/R$string;
D/dalvikvm(11358): VFY: replacing opcode 0x60 at 0x0009
W/dalvikvm(11358): VFY: unable to resolve static field 1988 (common_google_play_services_enable_button) in Lcom/google/android/gms/R$string;
D/dalvikvm(11358): VFY: replacing opcode 0x60 at 0x0010
W/dalvikvm(11358): VFY: unable to resolve static field 1998 (common_google_play_services_update_button) in Lcom/google/android/gms/R$string;
D/dalvikvm(11358): VFY: replacing opcode 0x60 at 0x0017
W/dalvikvm(11358): VFY: unable to resolve static field 1995 (common_google_play_services_unknown_issue) in Lcom/google/android/gms/R$string;
D/dalvikvm(11358): VFY: replacing opcode 0x60 at 0x0004
I/dalvikvm(11358): DexOpt: unable to optimize static field ref 0x07c9 at 0x18 in Lcom/google/android/gms/common/GooglePlayServicesUtil;.b
I/dalvikvm(11358): DexOpt: unable to optimize static field ref 0x07c8 at 0x38 in Lcom/google/android/gms/common/GooglePlayServicesUtil;.b
I/dalvikvm(11358): DexOpt: unable to optimize static field ref 0x07c5 at 0x3f in Lcom/google/android/gms/common/GooglePlayServicesUtil;.b
I/dalvikvm(11358): DexOpt: unable to optimize static field ref 0x07cf at 0x46 in Lcom/google/android/gms/common/GooglePlayServicesUtil;.b
I/dalvikvm(11358): DexOpt: unable to optimize static field ref 0x07cc at 0x66 in Lcom/google/android/gms/common/GooglePlayServicesUtil;.b
D/Prime31 (11358): onConnectionFailed: result 4
D/Prime31 (11358): onConnectionFailed: since user didn't initiate sign-in, failing now.
D/dalvikvm(11358): GC_CONCURRENT freed 430K, 5% free 9477K/9936K, paused 2ms+2ms, total 27ms
I/Unity (11358): authenticationFailedEvent: Unknown error
I/Unity (11358):
I/Unity (11358): (Filename: ./Runtime/ExportGenerated/AndroidManaged/UnityEngineDebug.cpp Line: 54)
I/Unity (11358):
E/Prime31 (11358): Exception running command on UI thread: Not connected. Call connect() and wait for onConnected() to be called.
D/dalvikvm(11358): GC_CONCURRENT freed 385K, 5% free 9477K/9936K, paused 2ms+2ms, total 27ms
D/dalvikvm( 6765): GC_CONCURRENT freed 417K, 7% free 9483K/10172K, paused 7ms+2ms, total 32ms
E/Prime31 (11358): Exception running command on UI thread: Not connected. Call connect() and wait for onConnected() to be called.
D/dalvikvm(11358): GC_CONCURRENT freed 385K, 5% free 9478K/9936K, paused 2ms+2ms, total 29ms
D/dalvikvm(11358): GC_CONCURRENT freed 387K, 5% free 9478K/9936K, paused 6ms+1ms, total 62ms
D/Prime31 (11358): isGooglePlayServicesAvailable returned 0
D/Prime31 (11358): beginUserInitiatedSignIn: continuing pending sign-in flow.
D/Prime31 (11358): resolveConnectionResult: trying to resolve result: ConnectionResult{statusCode=SIGN_IN_REQUIRED, resolution=PendingIntent{423c8fe8: android.os.BinderProxy#423c8f88}}
D/Prime31 (11358): --------------------- result has resolution. Starting it. --------------------
I/ActivityManager( 506): START u0 {cmp=com.phyken.wizardopstactics/com.prime31.PlayServicesProxyActivity} from pid 11358
D/dalvikvm(11358): GC_CONCURRENT freed 384K, 5% free 9481K/9936K, paused 5ms+4ms, total 80ms
1) There isn't any problem in two services using the resources folder. All the resources will be on the final APK, just pay attention on the resources names so they don't conflict. The best practice is to use a suffix (example: fb_logo.png and google_logo.png, instead of two logo.png images)
2) Not needed!
If you posted the error log it would have been easier to help and point the exact issue!

Why can disabling obfuscation in ProGuard break the optimization step?

We've recently decided to disable code obfuscation in our Android build, since while it makes the final APK slightly larger, it makes debugging so much more difficult.
Ever since we've done that, I keep running into crashes in our app that were not present before, i.e. while obfuscation was still active. Usually these crashes are caused by Java VerifyErrors or NoSuchMethodErrors.
Here are two of these errors I suddenly see when I disable obfuscation:
Could not find method org.apache.http.HttpConnectionMetrics.getResponseCount, referenced from method com.google.android.apps.analytics.PipelinedRequester.sendRequests
W/dalvikvm( 6652): VFY: unable to resolve virtual method 16112: Lorg/apache/http/HttpConnectionMetrics;.getResponseCount ()J
W/dalvikvm( 6652): VFY: rejecting opcode 0x6e at 0x000c
W/dalvikvm( 6652): VFY: rejected Lcom/google/android/apps/analytics/PipelinedRequester;.sendRequests ()V
W/dalvikvm( 6652): Verifier rejected class Lcom/google/android/apps/analytics/PipelinedRequester;
D/dalvikvm( 6652): GC_CONCURRENT freed 253K, 46% free 3261K/6023K, external 0K/0K, paused 2ms+2ms
I/dalvikvm( 6652): Rejecting re-init on previously-failed class Lcom/google/android/apps/analytics/PipelinedRequester; v=0x4062de30
D/AndroidRuntime( 6652): Shutting down VM
W/dalvikvm( 6652): threadid=1: thread exiting with uncaught exception (group=0x400a7560)
E/AndroidRuntime( 6652): FATAL EXCEPTION: main
E/AndroidRuntime( 6652): java.lang.VerifyError: com/google/android/apps/analytics/PipelinedRequester
...
I could resolve this error by disabling class merging via !class/merging/*
Another error I was seeing was this:
I/dalvikvm( 7292): DexOpt: access denied from Lcom/urbanairship/analytics/EventUploadManager; to field Lorg/apache/http/entity/AbstractHttpEntity;.contentEncoding
W/dalvikvm( 7292): VFY: unable to resolve instance field 5188
D/dalvikvm( 7292): VFY: replacing opcode 0x5b at 0x00ec
I/dalvikvm( 7292): Could not find method org.apache.http.conn.scheme.PlainSocketFactory.<init>, referenced from method com.google.android.apps.analytics.PipelinedRequester.<init>
W/dalvikvm( 7292): VFY: unable to resolve direct method 15044: Lorg/apache/http/conn/scheme/PlainSocketFactory;.<init> (B)V
D/dalvikvm( 7292): VFY: replacing opcode 0x70 at 0x0003
D/dalvikvm( 7292): VFY: dead code 0x0006-0009 in Lcom/google/android/apps/analytics/PipelinedRequester;.<init> (Lorg/apache/http/HttpHost;)V
I/dalvikvm( 7292): DexOpt: access denied from Lcom/google/android/apps/analytics/PipelinedRequester; to field Lorg/apache/http/impl/SocketHttpClientConnection;.open
W/dalvikvm( 7292): VFY: unable to resolve instance field 5234
D/dalvikvm( 7292): VFY: replacing opcode 0x55 at 0x0006
D/dalvikvm( 7292): VFY: dead code 0x0008-000e in Lcom/google/android/apps/analytics/PipelinedRequester;.closeConnection ()V
D/dalvikvm( 7292): VFY: dead code 0x0010-0011 in Lcom/google/android/apps/analytics/PipelinedRequester;.closeConnection ()V
I/dalvikvm( 7292): DexOpt: access denied from Lcom/google/android/apps/analytics/PipelinedRequester; to field Lorg/apache/http/impl/SocketHttpClientConnection;.open
W/dalvikvm( 7292): VFY: unable to resolve instance field 5234
D/dalvikvm( 7292): VFY: replacing opcode 0x55 at 0x0006
D/dalvikvm( 7292): VFY: dead code 0x0008-0009 in Lcom/google/android/apps/analytics/PipelinedRequester;.addRequest (Lorg/apache/http/HttpEntityEnclosingRequest;)V
D/dalvikvm( 7292): GC_CONCURRENT freed 253K, 47% free 3251K/6023K, external 0K/0K, paused 2ms+3ms
I/dalvikvm( 7292): DexOpt: access denied from Lcom/google/android/apps/analytics/PipelinedRequester; to field Lorg/apache/http/impl/AbstractHttpClientConnection;.metrics
W/dalvikvm( 7292): VFY: unable to resolve instance field 5225
D/dalvikvm( 7292): VFY: replacing opcode 0x54 at 0x0008
D/dalvikvm( 7292): VFY: dead code 0x000a-0090 in Lcom/google/android/apps/analytics/PipelinedRequester;.sendRequests ()V
D/AndroidRuntime( 7292): Shutting down VM
W/dalvikvm( 7292): threadid=1: thread exiting with uncaught exception (group=0x400a7560)
E/AndroidRuntime( 7292): FATAL EXCEPTION: main
E/AndroidRuntime( 7292): java.lang.NoSuchMethodError: org.apache.http.conn.scheme.PlainSocketFactory.<init>
This one I could resolve by setting !method/propagation/*
But why do these problems only appear with obfuscation disabled? Shouldn't one have no impact on the other?
The obfuscation was saving you because it was renaming your copies of the Apache HttpClient classes to names that wouldn't collide with the copies of those classes already present in Android.
Nasty place to be... you might want to consider not using Apache HttpClient at all, and using the in-built HttpURLConnection class as suggested by Jesse Wilson:
http://android-developers.blogspot.com/2011/09/androids-http-clients.html
You could try this Android-friendly veneer on HttpURLConnection:
https://github.com/kevinsawicki/http-request
If you really have to use Apache HttpClient, either use the old version embedded in Android, or try tweaking your ProGuard configuration to just obfuscate the HttpClient libraries.

Categories

Resources