I'm using the Android V2 Google Maps Library (Google Play Services) in my published app. I've been seeing sporadic exceptions show up in Google Play that seem to suggest the support map fragment occasionally tries to check the network state. However, the library documentation does not mention that this permission is required. I don't check the network state directly in my application, so I did not declare this permission. As a result a SecurityException is sometimes thrown when inflating the support map fragment:
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.foo/com.foo.ui.TransactionDetailActivity}: android.view.InflateException: Binary XML file line #327: Error inflating class fragment
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
at android.app.ActivityThread.access$600(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5039)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.view.InflateException: Binary XML file line #327: Error inflating class fragment
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
at android.view.LayoutInflater.inflate(LayoutInflater.java:459)
at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:270)
at com.actionbarsherlock.internal.ActionBarSherlockNative.setContentView(SourceFile:119)
at com.actionbarsherlock.app.SherlockFragmentActivity.setContentView(SourceFile:262)
at com.foo.ui.TransactionDetailActivity.onCreate(SourceFile:129)
at android.app.Activity.performCreate(Activity.java:5104)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
... 11 more
Caused by: java.lang.SecurityException: ConnectivityService: Neither user 10106 nor current process has android.permission.ACCESS_NETWORK_STATE.
at android.os.Parcel.readException(Parcel.java:1425)
at android.os.Parcel.readException(Parcel.java:1379)
at android.net.IConnectivityManager$Stub$Proxy.getActiveNetworkInfo(IConnectivityManager.java:623)
at android.net.ConnectivityManager.getActiveNetworkInfo(ConnectivityManager.java:425)
at maps.bm.e.e(Unknown Source)
at maps.bm.e.a(Unknown Source)
at maps.z.ag.a(Unknown Source)
at maps.z.ag.a(Unknown Source)
at maps.z.ag.a(Unknown Source)
at maps.z.bw.a(Unknown Source)
at maps.z.r.onCreateView(Unknown Source)
at com.google.android.gms.maps.internal.IMapFragmentDelegate$Stub.onTransact(IMapFragmentDelegate.java:107)
at android.os.Binder.transact(Binder.java:310)
at com.google.android.gms.maps.a.l.a(Unknown Source)
at com.google.android.gms.maps.m.a(Unknown Source)
at com.google.android.gms.internal.ap.a(Unknown Source)
at com.google.android.gms.internal.al.a(Unknown Source)
at com.google.android.gms.internal.al.a(Unknown Source)
at com.google.android.gms.maps.SupportMapFragment.onCreateView(Unknown Source)
at android.support.v4.app.FragmentManagerImpl.moveToState(SourceFile:846)
at android.support.v4.app.FragmentManagerImpl.moveToState(SourceFile:1061)
at android.support.v4.app.FragmentManagerImpl.addFragment(SourceFile:1160)
at android.support.v4.app.FragmentActivity.onCreateView(SourceFile:272)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:676)
... 28 more
I have declared the relevant permission in my manifest and will see if that fixes the problem. However, it's concerning that this would only happen on some devices and not others. For example, this has worked fine on our internal test devices and many others. Does anyone have any insight into this mysterious issue? Could it be caused by a proguard error?
Edit 1: This error occurred while using version 2.0.10 (541717-10) of the Google Play Services library.
With the latest release of the Google Play Services library the documentation has been updated to indicate this permission is required.
The release notes indicate why this permission is required:
Improved recovery from gaining network connectivity. This fix requires the ACCESS_NETWORK_STATE permission.
Yes. Any use of the getActiveNetworkInfo() method will require the network state access permission.
The following line in your Manifest should do the trick:
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
Related
Using the following code on my App is causing the App to crash if the device Google Play services version is not updated.
GoogleApiAvailability googleAPI = GoogleApiAvailability.getInstance();
status = googleAPI.isGooglePlayServicesAvailable(mActivity);
It is crashing on a device with Android OS version 4.2.2 and Google Play Services version 3.1.58( which I have purposefully downgraded , to handle the Google Play Services availaibility check).
Crash Logs is given below,
FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to start activity
ComponentInfo{com.companyname/o.Dt}:
java.lang.NullPointerException
at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2249)
at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2299)
at android.app.ActivityThread.access$700(ActivityThread.java:154)
at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1284)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5306)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException
at o.Lf.(:191)
at o.Lf.ˊ(:237)
at o.Dt.onCreate(:487)
at android.app.Activity.performCreate(Activity.java:5255)
at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1097)
at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2213)
at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2299)
at android.app.ActivityThread.access$700(ActivityThread.java:154)
at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1284)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5306)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
at dalvik.system.NativeStart.main(Native Method)
The NullPointer is pointing at some framework class even whose name is obfuscated. SO, any help would be appreciated.
Maybe the error is not in your code. Going by the package name, the error appears to be coming from a publicly available app
I updated an app in goolge play store with a new version.Now if app open then Application class not found exception occurs.
App works fine if the apk install directly .But not from play store.
Crash analytics report says
java.lang.RuntimeException: Unable to instantiate application com.xxx.xx.GetJsonArrayFromChannelUrl: java.lang.ClassNotFoundException: Didn't find class "com.xxx.xxx.GetJsonArrayFromChannelUrl" on path: /data/app/com.xx.xx-2.apk
at android.app.LoadedApk.makeApplication(LoadedApk.java:504)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4584)
at android.app.ActivityThread.access$1400(ActivityThread.java:158)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1356)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:176)
at android.app.ActivityThread.main(ActivityThread.java:5365)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.xxxx.fetchdata.GetJsonArrayFromChannelUrl" on path: /data/app/com.xx.xx-2.apk
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:65)
at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
at android.app.Instrumentation.newApplication(Instrumentation.java:985)
at android.app.LoadedApk.makeApplication(LoadedApk.java:499)
Follow these steps.
Clean your libraries
Right click on project > Android Tools > Fix Project properties
Project > Clean
I have a problem but could not be found any solution, I use AsyncHttpClient in https://github.com/AsyncHttpClient/async-http-client, I can run my code in API level 10, but not in API level 17. I am getting this error:
11-13 14:36:47.987 13294-13294/com.modilisim.antalyaticaretborsasi E/com.modilisim.antalyaticaretborsasi.view.fragment.ScrollingBultenlerFragment﹕ error occurred while getting daily bultenler
java.util.concurrent.ExecutionException: java.net.ConnectException: http://...
at com.ning.http.client.providers.netty.NettyResponseFuture.abort(NettyResponseFuture.java:328)
at com.ning.http.client.providers.netty.NettyConnectListener.operationComplete(NettyConnectListener.java:106)
at org.jboss.netty.channel.DefaultChannelFuture.notifyListener(DefaultChannelFuture.java:427)
at org.jboss.netty.channel.DefaultChannelFuture.addListener(DefaultChannelFuture.java:145)
at com.ning.http.client.providers.netty.NettyAsyncHttpProvider.doConnect(NettyAsyncHttpProvider.java:1056)
at com.ning.http.client.providers.netty.NettyAsyncHttpProvider.execute(NettyAsyncHttpProvider.java:880)
at com.ning.http.client.AsyncHttpClient.executeRequest(AsyncHttpClient.java:521)
at com.ning.http.client.AsyncHttpClient$BoundRequestBuilder.execute(AsyncHttpClient.java:238)
at com.modilisim.antalyaticaretborsasi.presenter.BultenPresenter.getDailyBultenler(BultenPresenter.java:126)
at com.modilisim.antalyaticaretborsasi.presenter.BultenPresenter.getDailyBultenler(BultenPresenter.java:102)
at com.modilisim.antalyaticaretborsasi.view.fragment.ScrollingBultenlerFragment.onCreateView(ScrollingBultenlerFragment.java:51)
at android.support.v4.app.Fragment.performCreateView(Fragment.java:1500)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:900)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1082)
at android.support.v4.app.FragmentManagerImpl.addFragment(FragmentManager.java:1184)
at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:291)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:676)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
at android.view.LayoutInflater.parseInclude(LayoutInflater.java:830)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:736)
at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
at com.modilisim.antalyaticaretborsasi.view.fragment.MainFragment.onCreateView(MainFragment.java:42)
at android.support.v4.app.Fragment.performCreateView(Fragment.java:1500)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:927)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1104)
at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:682)
at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1467)
at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:570)
at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1164)
at android.app.Activity.performStart(Activity.java:5114)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2269)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2356)
at android.app.ActivityThread.access$600(ActivityThread.java:150)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1244)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5195)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:795)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:562)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.net.ConnectException: http://...
at com.ning.http.client.providers.netty.NettyConnectListener.operationCom
I am doing a project in a company so I had to hide the urls in the error code above, but urls are working, they are not problem. Any help appreciated, thanks.
I learned that this AsyncHttpClient library is not for Android, so it is not working properly on all versions of Android. There is a library parallel to this library for Android: http://loopj.com/android-async-http/
I am getting class not found exception on some android devices, it's happening only on some devices.
This is the call-stack i have got,
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.picframes.android/com.picframes.android.first}: java.lang.ClassNotFoundException: com.picframes.android.first
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2121)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2240)
at android.app.ActivityThread.access$600(ActivityThread.java:139)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1262)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:156)
at android.app.ActivityThread.main(ActivityThread.java:4987)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: com.picframes.android.first
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
at android.app.Instrumentation.newActivity(Instrumentation.java:1039)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2112)
Any suggestions for resolving this problem, I could not reproduce this problem on my device.
On devices with which android version program works and where it doesn't work? I am not sure if this is the case but you probably get this error on older devices, is that right? You should make sure that all the functionality of your program is available on older systems. Use your manifest file:
<uses-sdk android:minSdkVersion="integer"
android:targetSdkVersion="integer"
android:maxSdkVersion="integer" />
to define minimum sdk version, and you will get errors in your code if you are trying to use features that are not available on the device that you target.
I have a project that uses the GoogleMaps API, and the support library for Fragments. I have a working map in one activity already, so I know that the API and library are all set up right. I am trying to add a map in a fragment as part of a new activity.
The activity extends an android.support.v4.app.FragmentActivity, and the xml file contains:
<fragment
android:id="#+id/map"
android:layout_width="match_parent"
android:layout_height="250dp"
android:name="com.google.android.gms.maps.SupportMapFragment" />
But when I run I get the error:
01-20 11:58:31.535: ERROR/AndroidRuntime(5389): FATAL EXCEPTION: main
java.lang.NoClassDefFoundError: com.google.android.gms.R$styleable
at com.google.android.gms.maps.GoogleMapOptions.createFromAttributes(Unknown Source)
at com.google.android.gms.maps.SupportMapFragment.onInflate(Unknown Source)
at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:279)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:669)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:739)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:742)
at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:251)
at android.app.Activity.setContentView(Activity.java:1835)
at com.yedidyak.gpsalarm.AddAlarm.onCreate(AddAlarm.java:19)
at android.app.Activity.performCreate(Activity.java:4465)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
at android.app.ActivityThread.access$600(ActivityThread.java:123)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4424)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
at dalvik.system.NativeStart.main(Native Method)
All the information I can find about this error is about not having the google-play-lib properly installed both as a jar and an imported module, but I have that done - and a working map in another activity.
Any ideas?
You have to reference google play services library instead of adding jar and map_attrs.xml (and other files, like strings.xml) to your project.
If you do, you also might have deleted res/values/map_attrs.xml by accident.