SecurityException - ConnectivityException (not always) - android

A user reports on Google Play ONLY 3 times the following error:
java.lang.RuntimeException: An error occured while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:278)
at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:273)
at java.util.concurrent.FutureTask.setException(FutureTask.java:124)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:307)
at java.util.concurrent.FutureTask.run(FutureTask.java:137)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
at java.lang.Thread.run(Thread.java:856)
Caused by: java.lang.SecurityException: ConnectivityService: Neither user 10103 nor current process has android.permission.ACCESS_NETWORK_STATE.
at android.os.Parcel.readException(Parcel.java:1327)
at android.os.Parcel.readException(Parcel.java:1281)
at android.net.IConnectivityManager$Stub$Proxy.getActiveNetworkInfo(IConnectivityManager.java:597)
(...)
My AndroidManifest.xml contains the following permissions:
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_GPS" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.CALL_PHONE" />
I think that it's all right because only this user reports this error. But why? It could be a device specific error, or device configuration error? The device is a Galaxy Tab 10.1 (GT-P7500) running Android 4.0.3-4.0.4 (Google Play data)

Related

How to fix "Game Crush because of java.lang.Error: FATAL EXCEPTION "?

After I uploaded my game to the Play Store my game crashed on a device showing java.lang.Error: FATAL EXCEPTION The game is developed on Unity Version: 2018.3.0f2.
java.lang.Error: FATAL EXCEPTION [Thread-296]
Unity version : 2018.3.0f2
Device model : samsung SM-J600FN
Device fingerprint: samsung/j6ltexx/j6lte:9/PPR1.180610.011/J600FNXXU3BSD2:user/release-keys
Caused by
at ly.b (com.google.android.gms.policy_ads_fdr_dynamite#20290003#20290003.249178941.249178941:2)
at lx.a (com.google.android.gms.policy_ads_fdr_dynamite#20290003#20290003.249178941.249178941:1)
at lz.a (com.google.android.gms.policy_ads_fdr_dynamite#20290003#20290003.249178941.249178941:29)
at com.google.android.gms.ads.internal.util.aq.a (com.google.android.gms.policy_ads_fdr_dynamite#20290003#20290003.249178941.249178941:10)
at lc.a (com.google.android.gms.policy_ads_fdr_dynamite#20290003#20290003.249178941.249178941:8)
at lc.run (com.google.android.gms.policy_ads_fdr_dynamite#20290003#20290003.249178941.249178941:2)
Caused by: java.lang.ClassNotFoundException:
at dalvik.system.BaseDexClassLoader.findClass (BaseDexClassLoader.java:134)
at java.lang.ClassLoader.loadClass (ClassLoader.java:379)
at ab.loadClass (com.google.android.gms.dynamite_dynamiteloader#17455079#17.4.55 (100306-248795830):4)
at java.lang.ClassLoader.loadClass (ClassLoader.java:312)
AndroidManifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.google.unity.ads"
android:versionName="1.0"
android:versionCode="1">
<uses-sdk android:minSdkVersion="14"
android:targetSdkVersion="19" />
<application>
<meta-data
android:name="com.something.something"
android:value="something"/>
<activity
android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>
</application>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
</manifest>

BAD_AUTHENTICATION. Account: <ELLIDED:721307821>, App: com.google.android.gms

I am having issue to Display the map on the Application.Its Showing error of the BAD_AUTHENTICATION.I am quite Surprised that it is Working properly yesterday but now the Log is Showing BAD_AUTHENTICATION. Account.
Manifest
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="********" />
Log
10-04 07:50:21.901 2074-3612/com.google.android.gms.persistent E/Auth: [GoogleAccountDataServiceImpl] getToken() -> BAD_AUTHENTICATION. Account: <ELLIDED:721307821>, App: com.google.android.gms, Service: oauth2:https://www.googleapis.com/auth/emeraldsea.mobileapps.doritos.cookie
edx: Long live credential not available.
at edy.b(:com.google.android.gms#11509470:10)
at edy.a(:com.google.android.gms#11509470:50)
at ecl.a(:com.google.android.gms#11509470:50)
at flk.a(:com.google.android.gms#11509470:8)
at flk.a(:com.google.android.gms#11509470:4)
at fkj.a(:com.google.android.gms#11509470:2)
at fkh.a(:com.google.android.gms#11509470:17)
at fkh.a(:com.google.android.gms#11509470:6)
at bsr.a(:com.google.android.gms#11509470:203)
at bsr.a(:com.google.android.gms#11509470:61)
at bsr.onTransact(:com.google.android.gms#11509470:6)
at android.os.Binder.transact(Binder.java:499)
at buy.onTransact(:com.google.android.gms#11509470:3)
at android.os.Binder.execTransact(Binder.java:565)
How can this issue be solved???

camera app crashing at camera.open [duplicate]

This question already has answers here:
How to fix "Fail to connect to camera service" exception in Android emulator
(7 answers)
Closed 1 year ago.
i am developing an android app which has an flash option which is set to auto mode,but it crashes at camera.open.I have used intent to open camera
Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
int result = context.checkCallingOrSelfPermission(Manifest.permission.CAMERA);
int result2 = context.checkCallingOrSelfPermission(Manifest.permission.FLASHLIGHT);
if((result==PackageManager.PERMISSION_GRANTED) && (result2==PackageManager.PERMISSION_GRANTED)) {
cam = Camera.open();
Camera.Parameters p = cam.getParameters();
p.setFlashMode(Camera.Parameters.FLASH_MODE_ON);
cam.setParameters(p);
cam.startPreview();
}
cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, fileUri);
startActivityForResult(cameraIntent,CAMERA_CAPTURE_IMAGE_REQUEST_CODE);
}});
HERE IS LOGCAT
04-10 15:44:58.928 13248-13248/com.t4u.aapam E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.t4u.aapam, PID: 13248
java.lang.RuntimeException: Fail to connect to camera service
at android.hardware.Camera.<init>(Camera.java:529)
at android.hardware.Camera.open(Camera.java:379)
at com.t4u.aapam.ListViewDisplay$1.onItemClick(ListViewDisplay.java:402)
at android.widget.AdapterView.performItemClick(AdapterView.java:305)
at android.widget.AbsListView.performItemClick(AbsListView.java:1148)
at android.widget.AbsListView$PerformClick.run(AbsListView.java:3059)
at android.widget.AbsListView$3.run(AbsListView.java:3866)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5292)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:904)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:699)
here is my manifest file.i have added camera permission and flashlight permisssion.I have also added camera hardware permisssion
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.t4u.aapam">
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="com.telematics4u.permission.MAPS_RECEIVE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.FLASHLIGHT" />
<uses-feature android:name="android.hardware.camera" android:required="false" />
<uses-feature android:name="android.hardware.camera.flash"
android:required="false" />
<application
android:name="com.t4u.aapam.App"
android:allowBackup="true"
android:icon="#drawable/launcher_logo"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
I may be wrong(because I don't see your Manifest.xml file) but there are two solutions I can see
1) The camera cannot be connected to because it is already being used by a different application
You cannot fix that. If the camera is occupied, you can't open it.
2) You haven't requested the Camera-permission.
This can be solved. In your manifest:
<uses-permission android:name="android.permission.CAMERA"/>
And if you are targeting android 6 you have to request the permission at runtime. For that, see this link.
EDIT:
Make sure you add all of these. This will give your app access to the camera and flashlight in software and hardware.
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.FLASHLIGHT" />
<uses-feature android:name="android.hardware.camera"/>
<uses-feature android:name="android.hardware.camera.flash"/>
Using these without requiring them makes the app not work if the device (against all odds) doesn't have a camera
you should use all these permissions
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.FLASHLIGHT" />
<uses-feature android:name="android.hardware.camera" android:required="false" />
<uses-feature android:name="android.hardware.camera.flash"
android:required="false" />
Maybe this can help but i am not sure
<permission android:name="android.permission.FLASHLIGHT"
android:permissionGroup="android.permission-
group.HARDWARE_CONTROLS"
android:protectionLevel="normal"/>

First time audio recoding permission get issue

java.lang.RuntimeException: setAudioSource failed.
11-07 20:30:16.294 12438-12438/com.main.sample W/System.err: at android.media.MediaRecorder.setAudioSource(Native Method)
11-07 20:30:16.294 12438-12438/com.main.sample W/System.err: at com.main.sample.Activity.EventsaddActivity.initializeMediaRecord
In the first step you need to add these permissions:
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
set target sdk to 22 or use request permission and set target to 23 or above.
and check your path again
MediaRecorder.setAudioSource(new File("YOUR_PATH"));

C2D_MESSAGE permission error?

This seems to be a fairly common question without a good answer. I've just followed the google guide for GCM push messaging and am getting this error:
E/AndroidRuntime(21779): java.lang.RuntimeException: Unable to start activity ComponentInfo{eric.bander.app/eric.bander.app.MenuScreen}: java.lang.IllegalStateException: Application does not define permission eric.bander.app.permission.C2D_MESSAGE
E/AndroidRuntime(21779): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1968)
E/AndroidRuntime(21779): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1993)
E/AndroidRuntime(21779): at android.app.ActivityThread.access$600(ActivityThread.java:127)
E/AndroidRuntime(21779): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1159)
E/AndroidRuntime(21779): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime(21779): at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime(21779): at android.app.ActivityThread.main(ActivityThread.java:4507)
E/AndroidRuntime(21779): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(21779): at java.lang.reflect.Method.invoke(Method.java:511)
E/AndroidRuntime(21779): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:978)
E/AndroidRuntime(21779): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:745)
E/AndroidRuntime(21779): at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime(21779): Caused by: java.lang.IllegalStateException: Application does not define permission eric.bander.app.permission.C2D_MESSAGE
E/AndroidRuntime(21779): at com.google.android.gcm.GCMRegistrar.checkManifest(GCMRegistrar.java:137)
E/AndroidRuntime(21779): at eric.bander.app.MenuScreen.onCreate(MenuScreen.java:43)
E/AndroidRuntime(21779): at android.app.Activity.performCreate(Activity.java:4469)
E/AndroidRuntime(21779): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1052)
E/AndroidRuntime(21779): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1932)
Here is my manifest file:
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="15" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.CONTROL_LOCATION_UPDATES" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<permission android:name="eric.bander.app.permission.C2D_MESSAGE" android:protectionLevel="signature" />
<uses-permission android:name="eric.bander.app.permission.C2D_MESSAGE" />
<receiver
android:name="com.google.android.gcm.GCMBroadcastReceiver"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="eric.bander.app" />
</intent-filter>
</receiver>
This is the piece of code in MainMenu:
GCMRegistrar.checkDevice(this);
GCMRegistrar.checkManifest(this);
final String regId = GCMRegistrar.getRegistrationId(this);
if (regId.equals("")) {
GCMRegistrar.register(this, "808426403545");
} else {
Toast.makeText(this, GCMRegistrar.getRegistrationId(this), Toast.LENGTH_LONG).show();
}
And I don't know if its relevant but my app strucutre is like this with the GCM intent service in another package:
eric.bander
-MainMenu.class
eric.bander.misc
-GCMIntentService.class
I hope someone can help with this, always frustrating when you are following a tutorial.
TIA
My error was having GCMIntentService in a different package to the class that registered the GCM.

Categories

Resources