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

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

Related

Is it mandatory to include okio if an app wants to use okhttp3?

I have included okhttp3 and tested PATCH and DELETE methods in android versions less than LOLLIPOP (api 21). I did not include Okio and it worked fine. But, in the okhttp site they mention the following:
You'll also need Okio, which OkHttp uses for fast I/O and resizable buffers. Download the latest JAR.
Could anyone please confirm if Okio can be safely ignored to use OkHttp?
Additional info:
I saw the same warning logs with and without okio 1.14.0 in Android 4.1.2 Samsung Galaxy Note while making a PATCH call with OkHttp 3.10.0.
03-02 14:18:39.850 6123-6159/ W/dalvikvm: VFY: unable to find class referenced in signature (Ljava/nio/file/Path;)
03-02 14:18:39.850 6123-6159/ W/dalvikvm: VFY: unable to find class referenced in signature ([Ljava/nio/file/OpenOption;)
03-02 14:18:39.850 6123-6159/ I/dalvikvm: Could not find method java.nio.file.Files.newOutputStream, referenced from method okio.Okio.sink
03-02 14:18:39.855 6123-6159/ W/dalvikvm: VFY: unable to resolve static method 30883: Ljava/nio/file/Files;.newOutputStream (Ljava/nio/file/Path;[Ljava/nio/file/OpenOption;)Ljava/io/OutputStream;
03-02 14:18:39.855 6123-6159/ D/dalvikvm: VFY: replacing opcode 0x71 at 0x000b
03-02 14:18:39.860 6123-6159/ W/dalvikvm: VFY: unable to find class referenced in signature (Ljava/nio/file/Path;)
03-02 14:18:39.865 6123-6159/ W/dalvikvm: VFY: unable to find class referenced in signature ([Ljava/nio/file/OpenOption;)
03-02 14:18:39.865 6123-6159/ I/dalvikvm: Could not find method java.nio.file.Files.newInputStream, referenced from method okio.Okio.source
03-02 14:18:39.865 6123-6159/ W/dalvikvm: VFY: unable to resolve static method 30882: Ljava/nio/file/Files;.newInputStream (Ljava/nio/file/Path;[Ljava/nio/file/OpenOption;)Ljava/io/InputStream;
okio is necessary for okhttp3 to work. However it is included automatically as a transitive dependency. So there is no need to include it explicitly.

Application crashes in onCreate due to newrelic exception

I've created an Android app using Android Studio beta 0.8.2 and all was going well until the last few days when i started getting this exception just as i run it:
07-24 14:50:11.044 1176-1176/com.vme.vme I/Crashlytics﹕ Initializing Crashlytics 1.1.11.10
07-24 14:50:11.764 2325-2325/system_process D/MobileDataStateTracker﹕ default: Broadcast received: android.intent.action.ANY_DATA_STATE apnType=default
07-24 14:50:11.769 2325-2325/system_process D/MobileDataStateTracker﹕ default: Received state=CONNECTED, old=CONNECTED, reason=(unspecified)
07-24 14:50:15.079 1176-1176/com.vme.vme W/Crashlytics﹕ Crashlytics initialization was not completed in the allotted time.
07-24 14:50:15.104 1176-1176/com.vme.vme I/dalvikvm﹕ Could not find method com.newrelic.agent.android.instrumentation.Instrumentation.openConnection, referenced from method com.vme.vme.model.network.httpClient.BasicRequestHandler.openConnection
07-24 14:50:15.104 1176-1176/com.vme.vme W/dalvikvm﹕ VFY: unable to resolve static method 30466: Lcom/newrelic/agent/android/instrumentation/Instrumentation;.openConnection (Ljava/net/URLConnection;)Ljava/net/URLConnection;
07-24 14:50:15.104 1176-1176/com.vme.vme D/dalvikvm﹕ VFY: replacing opcode 0x71 at 0x0009
07-24 14:50:15.114 1176-1176/com.vme.vme I/dalvikvm﹕ Could not find method com.newrelic.agent.android.background.ApplicationStateMonitor.getInstance, referenced from method com.vme.vme.ui.activities_and_fragments.home.bases.VMEBaseActivity.onStart
07-24 14:50:15.114 1176-1176/com.vme.vme W/dalvikvm﹕ VFY: unable to resolve static method 30464: Lcom/newrelic/agent/android/background/ApplicationStateMonitor;.getInstance ()Lcom/newrelic/agent/android/background/ApplicationStateMonitor;
07-24 14:50:15.114 1176-1176/com.vme.vme D/dalvikvm﹕ VFY: replacing opcode 0x71 at 0x0000
07-24 14:50:15.114 1176-1176/com.vme.vme I/dalvikvm﹕ Could not find method com.newrelic.agent.android.background.ApplicationStateMonitor.getInstance, referenced from method com.vme.vme.ui.activities_and_fragments.home.bases.VMEBaseActivity.onStop
07-24 14:50:15.114 1176-1176/com.vme.vme W/dalvikvm﹕ VFY: unable to resolve static method 30464: Lcom/newrelic/agent/android/background/ApplicationStateMonitor;.getInstance ()Lcom/newrelic/agent/android/background/ApplicationStateMonitor;
07-24 14:50:15.114 1176-1176/com.vme.vme D/dalvikvm﹕ VFY: replacing opcode 0x71 at 0x0003
07-24 14:50:15.309 1176-1176/com.vme.vme D/AndroidRuntime﹕ Shutting down VM
07-24 14:50:15.309 1176-1176/com.vme.vme W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0x41797c80)
07-24 14:50:15.429 1176-1176/com.vme.vme E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.vme.vme, PID: 1176
java.lang.NoClassDefFoundError: com.newrelic.agent.android.background.ApplicationStateMonitor
at com.vme.vme.ui.activities_and_fragments.home.bases.VMEBaseActivity.onStart(VMEBaseActivity.java)
I never used newrelic in this project, i've searched "newrelic" and can't find it in the whole project.
Things i can share also:
I have 2 instance of the studio running all the time, in the other project **i am using newrelic - version 2.426.0 **
it's happened on Galaxy S3 and Note 2.
Cleaning, rebuilding, closing the studio, uninstalling and reinstalling are fixing the issue. BUT IT COME BACK EVERY ONCE A DAY :(
Please help...
Build your New Relic enabled project
Run gradle --stop from the terminal/command line
Open your non-NR enabled app and clean & rebuild
Run the app
If you still get messages about New Relic in your non-NR app, you can go to the ~/.gradle/caches and remove it. Then try the above steps again.
Newer versions of gradle utilize a daemon which caches New Relic instrumentation. So this will stop the daemon and allow the app to build.
You will also want to upgrade to the latest version of New Relic. 2.426.0 is many versions behind. Go here: http://docs.newrelic.com/docs/releases/android
The thing that fixed for me was upgrading to the newest gradle version 2.1 and android plugin version to 0.13.3 from right click project folder -> module settings
If you still get messages about New Relic in your non-NR app, you can go to the project directory and remove .gradle directory and re-build project.

Google Maps V2 Android works as fragment, but shows white screen (with zoom control) as child fragment

I've been researching this problem for a couple days and have tried everything offered by SO with no success.
When I follow instructions outlined by Google here, I have no problems getting a general Google Map displayed in a custom Map Fragment (QMapFragment) that extends SupportMapFragment under my FragmentActivity.
(Side Note: Even if I provide a dummy API Key, e.g., "abcd", in the Manifest.xml, the map is still displayed just fine. I'm confused by that, but anyway...)
But when I add QMapFragment as a child fragment to another custom Fragment, e.g., with the following code:
mFrag = QMapFragment.newInstance(new LatLng(location.getLatitude(), location.getLongitude()));
FragmentTransaction transaction = getChildFragmentManager().beginTransaction();
transaction.add(R.id.framelayout, mFrag).commit();
I see a blank screen with zoom controls being added to the fragment, and I get this in LogCat
08-08 13:44:25.914: W/dalvikvm(7057): VFY: unable to resolve instance field 30
08-08 13:44:25.914: D/dalvikvm(7057): VFY: replacing opcode 0x52 at 0x0012
08-08 13:44:25.914: D/dalvikvm(7057): VFY: dead code 0x0014-0018 in Lcom/google/android/gms/common/GooglePlayServicesUtil;.b (Landroid/content/res/Resources;)Z
08-08 13:44:26.000: I/dalvikvm(7057): Total arena pages for JIT: 11
08-08 13:44:26.180: W/dalvikvm(7057): Unable to resolve superclass of Lmaps/p/w; (734)
08-08 13:44:26.180: W/dalvikvm(7057): Link of class 'Lmaps/p/w;' failed
08-08 13:44:26.180: W/dalvikvm(7057): Unable to resolve superclass of Lmaps/ap/as; (6056)
08-08 13:44:26.180: W/dalvikvm(7057): Link of class 'Lmaps/ap/as;' failed
08-08 13:44:26.180: W/dalvikvm(7057): Unable to resolve superclass of Lmaps/af/k; (5085)
08-08 13:44:26.180: W/dalvikvm(7057): Link of class 'Lmaps/af/k;' failed
08-08 13:44:26.187: E/dalvikvm(7057): Could not find class 'maps.af.k', referenced from method maps.ag.an.a
08-08 13:44:26.187: W/dalvikvm(7057): VFY: unable to resolve new-instance 4928 (Lmaps/af/k;) in Lmaps/ag/an;
Screenshot of properties
And no, I don't get an "Authorization Failed" from the debugger, and my console is set to Google Android v2 on Google API.
I remember having the same issue when using transaction.add. From then on one of my base rules was to never user transaction.add again and use transaction.replace instead.
Try it, it should work.

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

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

Why is android.util.LruCache.* not found when using android-support-v4?

I am writing a project that uses LruCache, which is included in the android-support-v4.jar compat library. When running on devices with JB, the code works fine, but when I run it on my Droid X with GB, the app dies with the following errors:
I/dalvikvm(2459): Could not find method android.util.LruCache.put, referenced from method blah.blah.Utility.getBitmap
W/dalvikvm(2459): VFY: unable to resolve virtual method 2641: Landroid/util/LruCache;.put (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
D/dalvikvm(2459): VFY: replacing opcode 0x6e at 0x0026
... [repeats similar lines] ...
W/dalvikvm(2459): Unable to resolve superclass of Lblah/blah/Utility$1; (353)
W/dalvikvm(2459): Link of class 'Lblah/blah/Utility$1;' failed
E/dalvikvm(2459): Could not find class 'blah.blah.Utility$1', referenced from method blah.blah.Utility.initCaches
W/dalvikvm(2459): VFY: unable to resolve new-instance 559 (Lblah/blah/Utility$1;) in Lblah/blah/Utility;
D/dalvikvm(2459): VFY: replacing opcode 0x22 at 0x000d
D/dalvikvm(2459): VFY: dead code 0x000f-002c in Lblah/blah/Utility;.initCaches (ILandroid/content/Context;)V
I/dalvikvm(2459): Could not find method android.util.LruCache.get, referenced from method blah.blah.Utility.mCacheGet
W/dalvikvm(2459): VFY: unable to resolve virtual method 2640: Landroid/util/LruCache;.get (Ljava/lang/Object;)Ljava/lang/Object;
D/dalvikvm(2459): VFY: replacing opcode 0x6e at 0x0008
D/dalvikvm(2459): VFY: dead code 0x000b-000e in Lblah/blah/Utility;.mCacheGet (Ljava/lang/String;)Landroid/graphics/Bitmap;
... [repeats similar lines] ...
D/AndroidRuntime(2459): Shutting down VM
W/dalvikvm(2459): threadid=1: thread exiting with uncaught exception (group=0x40018560)
E/AndroidRuntime(2459): FATAL EXCEPTION: main
E/AndroidRuntime(2459): java.lang.NoClassDefFoundError: blah.blah.Utility$1
E/AndroidRuntime(2459): at blah.blah.Utility.initCaches(Utility.java:49)
E/AndroidRuntime(2459): at blah.blah.MainActivity.onCreate(MainActivity.java:40)
... [etc] ...
W/ActivityManager(1318): Force finishing activity blah.blah/.MainActivity
Utility.java:49 looks like this:
mCache = new LruCache<String, Bitmap>( mCacheSize ) // <-- line 49 --
{
#Override
protected int sizeOf( String key, Bitmap bitmap )
{
return bitmap.getByteCount();
}
};
So everywhere I referenced LruCache or its methods causes an error. The first thing that comes to mind is that android-support-v4.jar was somehow left out of the APK file, but that doesn't look like the case. I've placed the jar file under libs/, and checking classes.dex.d after running ant debug, I see that it has added the following line:
/home/paul/workspace/blah/libs/android-support-v4.jar \
My second thought was that maybe LruCache isn't in android-support-v4, but looking at the source I see that the following source file is in there, and that it has the methods I am trying to use:
/home/paul/bin/android-sdk/extras/android/support/v4/src/java/android/support/v4/util/LruCache.java
So why isn't it found?
The classes in the support library use a different namespace.
You need to import:
import android.support.v4.util.LruCache;
or alternatively you can copy & compile LruCache.java directly into your app.

Categories

Resources