Cannot deploy my apps since updating SDK tools today [duplicate] - android

This question already has answers here:
Libraries do not get added to APK anymore after upgrade to ADT 22
(7 answers)
Closed 9 years ago.
This morning I updated various SDK components from Eclipse. I think it was
- Android SDK or Platform tools
- Google APIs 17 update
- Android Support Library
- Google Play Services
Now, my apps won't deploy. They build ok (eventually, after an hour of reconfiguring and rebuilding) but now when I deploy to the device, I get the following:
VFY: unable to find class referenced in signature (Landroid/support/v4/app/Fragment;)
VFY: unable to find class referenced in signature (Landroid/support/v4/app/Fragment;)
VFY: unable to find class referenced in signature (Landroid/support/v4/app/Fragment;)
Unable to resolve superclass of Lcom/com/myapp/MainActivity; (81)
Link of class 'Lcom/com/myapp/MainActivity;' failed
VFY: replacing opcode 0x71 at 0x0006
VFY: unable to find class referenced in signature (Landroid/support/v4/app/Fragment;)
Unable to resolve superclass of Lcom/com/myapp/MainActivity; (81)
Link of class 'Lcom/com/myapp/MainActivity;' failed
Shutting down VM
threadid=1: thread exiting with uncaught exception (group=0x40015560)
FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.myapp/com.myapp.MainActivity}: java.lang.ClassNotFoundException: com.myapp.MainActivity in loader dalvik.system.PathClassLoader[/data/app/com.myapp.apk]
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1680)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1784)
at android.app.ActivityThread.access$1500(ActivityThread.java:123)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:939)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:130)
at android.app.ActivityThread.main(ActivityThread.java:3835)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:864)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:622)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: com.myapp.MainActivity in loader dalvik.system.PathClassLoader[/data/app/myapp.apk]
at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1672)
... 11 more
Bear in mind that this project, and others, have been happily running for months, so this isn't just some daft error like the activity missing from the manifest file.
I'm really wishing I hadn't bothered with the update now... any ideas welcome!

I faced this issue couple of days before.
Right click your project, Go to properties->Java Build path->Order and Export
Check Android Private Library->Click Ok
Clean the project and run it.it will work.

sdk\extras\android\support\v4 inside there is a jar file android-support-v4.jar add this to the external jars

Related

Could not find class 'com.google.firebase.FirebaseOptions'

I have a working app and everything was working well, but when I updated it with MoPub app and generated a new signed APK and uploaded it to the play store some users reported a crash while it works well on other users' devices.
I tested the app a lot on different devices and finally found a device that it crashed on.
I debugged the app and found this error code in the android monitor
06-18 16:17:51.665 17951-17951/akhbar4all.com.akhbar4all W/dalvikvm:
VFY: unable to find class referenced in signature
(Lcom/google/firebase/auth/FirebaseUser;) 06-18 16:17:51.665
17951-17951/akhbar4all.com.akhbar4all E/dalvikvm: Could not find class
'com.google.firebase.FirebaseApp$zza', referenced from method
com.google.firebase.FirebaseApp.zza 06-18 16:17:51.665
17951-17951/akhbar4all.com.akhbar4all W/dalvikvm: VFY: unable to
resolve check-cast 9003 (Lcom/google/firebase/FirebaseApp$zza;) in
Lcom/google/firebase/FirebaseApp; 06-18 16:17:51.665
17951-17951/akhbar4all.com.akhbar4all D/dalvikvm: VFY: replacing
opcode 0x1f at 0x0019 06-18 16:17:51.665
17951-17951/akhbar4all.com.akhbar4all D/dalvikvm: DexOpt: unable to
opt direct call 0xec65 at 0x0b in
Lcom/google/firebase/FirebaseApp;.getToken 06-18 16:17:51.665
17951-17951/akhbar4all.com.akhbar4all D/AndroidRuntime: Shutting down
VM 06-18 16:17:51.665 17951-17951/akhbar4all.com.akhbar4all
W/dalvikvm: threadid=1: thread exiting with uncaught exception
(group=0x41bdc700) 06-18 16:17:51.685
17951-17951/akhbar4all.com.akhbar4all E/AndroidRuntime: FATAL
EXCEPTION: main
java.lang.NoClassDefFoundError: com.google.firebase.FirebaseOptions
at com.google.firebase.FirebaseApp.zzbu(Unknown Source)
at com.google.firebase.provider.FirebaseInitProvider.onCreate(Unknown
Source)
at
android.content.ContentProvider.attachInfo(ContentProvider.java:1214)
at
android.content.ContentProvider.attachInfo(ContentProvider.java:1189)
at
com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown
Source)
at
android.app.ActivityThread.installProvider(ActivityThread.java:5119)
at
android.app.ActivityThread.installContentProviders(ActivityThread.java:4725)
at
android.app.ActivityThread.handleBindApplication(ActivityThread.java:4665)
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:176)
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:1046)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:862)
at dalvik.system.NativeStart.main(Native Method)
But I was shocked because I didn't use any Firebase api so why is this happening and what is the solution? I'd be happy for any help from someone.
I resolved the problem.
The problem was that their is an error in firebase including latest google play services 9.0.2
So i choose only the google play services that i need and not the whole services excluding (firebase) and everything works well
To setup google services by what you need and don't include the whole services visit this link
Thanks, I had also compiled the multidex class to solve my problem but it made my application a little heavier, now it is better optimized!
This is to compile only the google services that you are going to use and not all with the compile statement 'com.google.android.gms: play-services: 9.0.0'
Now my gradle file looks like this
//compile 'com.android.support:multidex:1.0.0'
//compile 'com.google.android.gms:play-services:9.0.0'
compile 'com.google.firebase:firebase-messaging:9.0.0'
compile 'com.google.firebase:firebase-core:9.0.0'
compile 'com.google.firebase:firebase-database:9.0.0'
compile 'com.google.android.gms:play-services-location:9.0.0'

Android App crashes after integrating Google Play Services for AdMob using Pygame Subset for Android

i'm using Pgs4a (Pygame Subset for Android) to build my app. This works fine, until:
Recently i integrated the Google Play Services into my app for using Admob, but unfortunately my app crashes as soon as i launch it.
I already asked in Google Group for Admob, which recommended me to ask for help here. I also saw some posts here, but didn't solve my problem.
Here is, what i think, is the important part of my logcat.log
E/dalvikvm( 7969): dlopen("/data/app-lib/com.myapp-1/libsdl_mixer.so") failed: dlopen failed: cannot locate symbol "__gnu_thumb1_case_sqi" referenced by "libsdl_mixer.so"...
W/dalvikvm( 7969): threadid=15: thread exiting with uncaught exception (group=0x417f5da0)
E/AndroidRuntime( 7969): FATAL EXCEPTION: Thread-817
E/AndroidRuntime( 7969): Process: com.myapp, PID: 7969
E/AndroidRuntime( 7969): java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "__gnu_thumb1_case_sqi" referenced by "libsdl_mixer.so"...
E/AndroidRuntime( 7969): at java.lang.Runtime.loadLibrary(Runtime.java:365)
E/AndroidRuntime( 7969): at java.lang.System.loadLibrary(System.java:526)
E/AndroidRuntime( 7969): at org.renpy.android.PythonActivity.run(PythonActivity.java:280)
E/AndroidRuntime( 7969): at java.lang.Thread.run(Thread.java:841)
W/ActivityManager( 704): Force finishing activity com.myapp/org.renpy.android.PythonActivity
The libsdl_mixer.so is inside my pygs4a/libs/armeabi folder, if that helps.
Have you any ideas what i'm doing wrong?
I work on Windows 7 by the way.
Any help is much appreciated :)

googleMap.setMyLocationEnabled(true) won't work on older devices

I've been working with google maps on Android. It shows the map, I can add markers, move the camera.Everything works fine (from Android 2.3 to 4.x) until I put googleMap.setMyLocationEnabled(true). Then it just work on 4.x, and the app crashes on 2.3. This is what I got on LogCat:
07-23 20:56:25.080: E/dalvikvm(2214): Could not find class 'android.database.sqlite.SQLiteCantOpenDatabaseException', referenced from method com.google.android.gms.plus.provider.PlusProvider.a
07-23 20:56:25.090: W/dalvikvm(2214): VFY: unable to resolve instanceof 406 (Landroid/database/sqlite/SQLiteCantOpenDatabaseException;) in Lcom/google/android/gms/plus/provider/PlusProvider;
07-23 20:56:28.906: E/dalvikvm(2214): Could not find class 'android.os.UserManager', referenced from method cbe.c
07-23 20:56:28.906: W/dalvikvm(2214): VFY: unable to resolve check-cast 543 (Landroid/os/UserManager;) in Lcbe;
07-23 21:07:53.940: E/CheckinTask(2214): Checkin failed: https://android.clients.google.com/checkin (request #0): java.io.IOException: No Content-Type header

DraggableGridView can't be included in project

I am trying to include thquinn's DraggableGridView into my project. I followed all the instructions given there for getting started including these steps for adding a jar to my project. (DraggableGridView.jar is showing as a referenced library.)
It compiles correctly, but when run my project I get the following error in Logcat:
I/dalvikvm(798): Could not find method com.animoto.android.views.DraggableGridView.addView, referenced from method com.example.GuessWhat.GuessWhat.loadImages
W/dalvikvm(798): VFY: unable to resolve virtual method 11: Lcom/animoto/android/views/DraggableGridView;.addView (Landroid/view/View;)V
D/dalvikvm(798): VFY: replacing opcode 0x6e at 0x003a
E/dalvikvm(798): Could not find class 'com.animoto.android.views.DraggableGridView', referenced from method com.example.GuessWhat.GuessWhat.onCreate
W/dalvikvm(798): VFY: unable to resolve check-cast 15 (Lcom/animoto/android/views/DraggableGridView;) in Lcom/example/GuessWhat/GuessWhat;
D/dalvikvm(798): VFY: replacing opcode 0x1f at 0x0023
D/AndroidRuntime(798): Shutting down VM
W/dalvikvm(798): threadid=1: thread exiting with uncaught exception (group=0x40a71930)
E/AndroidRuntime(798): FATAL EXCEPTION: main
E/AndroidRuntime(798): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.GuessWhat/com.example.GuessWhat.GuessWhat}: android.view.InflateException: Binary XML file line #3: Error inflating class com.animoto.android.views.DraggableGridView
E/AndroidRuntime(798): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
E/AndroidRuntime(798): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
E/AndroidRuntime(798): at android.app.ActivityThread.access$600(ActivityThread.java:141)
E/AndroidRuntime(798): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
E/AndroidRuntime(798): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime(798): at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime(798): at android.app.ActivityThread.main(ActivityThread.java:5041)
E/AndroidRuntime(798): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(798): at java.lang.reflect.Method.invoke(Method.java:511)
E/AndroidRuntime(798): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
Here's my import:
import com.animoto.android.*;
In my activity I have:
DraggableGridView dgv = ((DraggableGridView) findViewById(R.id.dgv));
ImageView iv = new ImageView(getApplicationContext());
iv.setImageDrawable(new BitmapDrawable(Images[index]));
dgv.addView(iv);
The last line is where the build error is. What am I missing?
First of all, as Eclipse can resolve your dependency but Dalvik cannot, it seems that the library wasn't bundled with your application. The typical cause of this is adding your library as a normal Java dependency into /lib, whereas building for Android expects the jar in /libs. See also this question.
Secondly, looking at the source, it appears that your import is not specified correctly. DraggableGridView's qualified name is com.animoto.android.views.DraggableGridView.
Your activity should declare the import as:
import com.animoto.android.views.DraggableGridView;

Dalvik mess with library code and project cannot runs anymore

After updating ADT and Android SDK on my machine, all my projects get errors.
Now I have this:
PS: This error happens when running the project that have a jar as dependency (it was compiled with proguard and we dont have the original sourcecode to compile it again).
W/dalvikvm(3497): VFY: unable to resolve static field 994 (storeicon) in Lcom/ww/dgs/R$drawable;
D/dalvikvm(3497): VFY: replacing opcode 0x60 at 0x0042
W/dalvikvm(3497): VFY: unable to resolve static field 987 (libraryicon) in Lcom/ww/dgs/R$drawable;
D/dalvikvm(3497): VFY: replacing opcode 0x60 at 0x0060
W/dalvikvm(3497): VFY: unable to resolve static field 1069 (mainframe) in Lcom/ww/dgs/R$layout;
D/dalvikvm(3497): VFY: replacing opcode 0x60 at 0x00b1
I/dalvikvm(3497): DexOpt: unable to optimize static field ref 0x0467 at 0x16 in Lcom/ww/sharedlibrary/e;.a
D/AndroidRuntime(3497): Shutting down VM
W/dalvikvm(3497): threadid=1: thread exiting with uncaught exception (group=0x400f8760)
E/AndroidRuntime(3497): FATAL EXCEPTION: main
E/AndroidRuntime(3497): java.lang.NoClassDefFoundError: com.ww.dgs.R$layout
E/AndroidRuntime(3497): at com.ww.mainframe.MainFrame.onCreate(Unknown Source)
E/AndroidRuntime(3497): at com.ww.iba.DigiMag.onCreate(DigiMag.java:27)
E/AndroidRuntime(3497): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1048)
E/AndroidRuntime(3497): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1715)
E/AndroidRuntime(3497): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1767)
E/AndroidRuntime(3497): at android.app.ActivityThread.access$1500(ActivityThread.java:122)
E/AndroidRuntime(3497): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1005)
E/AndroidRuntime(3497): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime(3497): at android.os.Looper.loop(Looper.java:132)
E/AndroidRuntime(3497): at android.app.ActivityThread.main(ActivityThread.java:4028)
E/AndroidRuntime(3497): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(3497): at java.lang.reflect.Method.invoke(Method.java:491)
E/AndroidRuntime(3497): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:844)
E/AndroidRuntime(3497): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:602)
E/AndroidRuntime(3497): at dalvik.system.NativeStart.main(Native Method)
I/dalvikvm(3497): threadid=4: reacting to signal 3
I/dalvikvm(3497): Wrote stack traces to '/data/anr/traces.txt'
The code from com.ww is inside a jar that I used on the other builds.
I am getting this too now and am able to get around it by removing all external jars from the project. You can add them back in after it's been cleaned. I'm assuming you have access to the original project source code...
Rightclick on project, go to Java Build Path, and remove all external jars other than your Android libs. Then clean.
Got this error after updating to the Android Platform Tools preview 15 rc5 and Android Tools 21 rc5, plus running the "check for updates..." in eclipse.
LogCat error
java.lang.NoClassDefFoundError: com.someapplicationlibrary.lib.R$layout
Eclipse compiler error:
Errors occurred during the build.
Errors running builder 'Android Pre Compiler' on project 'myApplication'.
String index out of range: -51
Errors running builder 'Android Pre Compiler' on project 'someapplicationlibrary'.
String index out of range: -54
Tried to revert to the stabel Android Tools... but ending up with even more errors.
My solution was to load the workspace in a eclipse version that was not updated with the "check for updates..." in the eclipse Help menu.
Then it compiled correct, and the application worked again, hope this helps:)

Categories

Resources