Ich habe einen Absturz mit android.permission.UPDATE_DEVICE_STATS Erlaubnis in Crashlytics erhalten. Ich ersuche diese Erlaubnis nicht in meiner App, weil ich sie nicht brauche. Ich kann dieses Problem nicht reproduzieren. Der Absturz ist aufgetreten, als die App versucht hat, die Abfragemethode in ContentResolver aufzurufen.Android Absturz mit Erlaubnis UPDATE_DEVICE_STATS
Vielleicht stieß jemand auf dieses Problem und kennt Gründe oder wie man es repariert. Es geschah am Galaxy J5 (2016)
Fatal Exception: java.lang.RuntimeException: Unable to create application com.myapp.App: java.lang.SecurityException: uid 10166 does not have android.permission.UPDATE_DEVICE_STATS.
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6326)
at android.app.ActivityThread.access$1800(ActivityThread.java:223)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:158)
at android.app.ActivityThread.main(ActivityThread.java:7231)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
Caused by java.lang.SecurityException: uid 10166 does not have android.permission.UPDATE_DEVICE_STATS.
at android.os.Parcel.readException(Parcel.java:1620)
at android.os.Parcel.readException(Parcel.java:1573)
at android.app.ActivityManagerProxy.getContentProvider(ActivityManagerNative.java:4240)
at android.app.ActivityThread.acquireProvider(ActivityThread.java:6394)
at android.app.ContextImpl$ApplicationContentResolver.acquireUnstableProvider(ContextImpl.java:2380)
at android.content.ContentResolver.acquireUnstableProvider(ContentResolver.java:1521)
at android.content.ContentResolver.query(ContentResolver.java:486)
at android.content.ContentResolver.query(ContentResolver.java:445)
at com.myapp.wrapper.AppSettingWrapper.getDeviceId(AppSettingWrapper.java:103)
at com.myapp.wrapper.AppSettingWrapper.setNewDeviceId(AppSettingWrapper.java:160)
at com.myapp.App.onCreate(Mail2WorldApplication.java:70)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1037)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6323)
at android.app.ActivityThread.access$1800(ActivityThread.java:223)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:158)
at android.app.ActivityThread.main(ActivityThread.java:7231)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
EDIT: Code of GetDeviceID Methode
public static String getDeviceId(Context context){
boolean isNotEnd = true;
String deviceId = "";
while (isNotEnd) { // I guess this loop is needed to refetch data, if the app wasn't able to fetch getDeviceId from the first time
isNotEnd = false;
Uri uriDeviceId = AppSettingsContentProvider.DEVICE_ID_CONTENT_URI;
Cursor cursor = context.getContentResolver().query(uriDeviceId, null, null, null, null);
if(cursor != null){
try {
if(cursor.moveToFirst()) {
deviceId = cursor.getString(0);
}
} catch (CursorIndexOutOfBoundsException e){
isNotEnd = true;
}finally {
cursor.close();
}
}else{
isNotEnd = true;
}
}
return deviceId;
}
ich den Anruf zu 'setNewDeviceId vermuten()' bedeutet, dass Sie _do_ 'UPDATE_DEVICE_STATS' brauchen - aber Sie gewann‘ Das bekommst du, ohne eine "System" -App zu sein, was bedeutet, entweder dein eigenes ROM zu bauen oder das Telefon zu rooten. – TripeHound
@TripeHound Nein, setNewDeviceId() es ist meine Methode in Wrapper. Innerhalb von setNewDeviceId() rufe ich Abfrage an meinen Inhaltsanbieter – Dima
Können Sie 'com.myapp.wrapper.AppSettingWrapper.getDeviceId (AppSettingWrapper.java:103)'? – AxelH