大家好,请注意,我创建的应用程序不能在android版本9,10和11上运行。
我在较低的版本上测试了这个应用程序,它工作得很好,但当在版本9,10或11上测试时,应用程序总是崩溃
如果我的问题得到回答,我真的很感激。谢谢
下面是我的build.gradle文件
plugins {
id 'com.android.application'
id 'com.google.gms.google-services'
id 'com.google.firebase.crashlytics'
}
compileSdkVersion 30
buildToolsVersion "30.0.2"
defaultConfig {
applicationId "com.example.myrevisedlawcoursesapp300level"
minSdkVersion 19
targetSdkVersion 30
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
signingConfig signingConfigs.release
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
`}
`依赖关系{
implementation 'androidx.appcompat:appcompat:1.0.0'
implementation 'com.android.support:multidex:2.0.0'
implementation 'com.google.android.material:material:1.2.1'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.google.android.gms:play-services-ads:19.7.0'
implementation 'com.google.firebase:firebase-crashlytics'
implementation 'com.google.firebase:firebase-analytics'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}`
我的日志中的错误消息。虽然我看不到任何线索
02-13 07:21:45.075 308-308/? A/DEBUG: Tombstone written to: /data/tombstones/tombstone_01
02-13 07:22:09.934 30407-30420/? A/libc: Fatal signal 7 (SIGBUS), code 1, fault addr 0xc0011 in tid 30420 (Compiler driver)
02-13 07:22:10.038 308-308/?A/DEBUG:*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
02-13 07:22:10.039 308-308/? A/DEBUG: Build fingerprint: 'TCL/5056I/POP455C:6.0.1/MMB29M/vHAJ9-0:user/release-keys' 02-13 07:22:10.039 308-308/? A/DEBUG: Revision: '0' 02-13 07:22:10.039 308-308/? A/DEBUG: ABI: 'arm' 02-13 07:22:10.039 308-308/? A/DEBUG: pid: 30407, tid: 30420, name: Compiler driver >>> /system/bin/dex2oat <<< 02-13 07:22:10.039 308-308/? A/DEBUG: signal 7 (SIGBUS), code 1 (BUS_ADRALN), fault addr 0xc0011 02-13 07:22:10.051 308-308/? A/DEBUG: r0 b1c6004c r1 ffff0006 r2 000c0001 r3 ffff0006 02-13 07:22:10.051 308-308/? A/DEBUG: r4 b1c45638 r5 b1c639ec r6 b1c63af0 r7 00250000 02-13 07:22:10.051 308-308/? A/DEBUG: r8 b1c63958 r9 ffffffff sl b1c63950 fp b1c6395c 02-13 07:22:10.051 308-308/? A/DEBUG: ip b1e522f6 sp b1e522e8 lr b1c60a18 pc b6c56904 cpsr 20070030 02-13 07:22:10.087 308-308/? A/DEBUG: backtrace: 02-13 07:22:10.087 308-308/? A/DEBUG: #00 pc 000e7904 /system/lib/libart-compiler.so (_ZN3art19LocalValueNumbering16HandleInvokeArgsEPKNS_3MIREPKS0_+199) 02-13 07:22:10.087 308-308/? A/DEBUG: #01 pc 000eac3d /system/lib/libart-compiler.so (_ZN3art19LocalValueNumbering14GetValueNumberEPNS_3MIRE+608) 02-13 07:22:10.088 308-308/? A/DEBUG: #02 pc 001badb3 /system/lib/libart-compiler.so (_ZN3art8MIRGraph28ApplyGlobalValueNumberingEndEv+186) 02-13 07:22:10.088 308-308/? A/DEBUG: #03 pc 001bcd9b /system/lib/libart-compiler.so (_ZN3art16PassDriverMEOpts9ApplyPassEPNS_14PassDataHolderEPKNS_4PassE+38) 02-13 07:22:10.088 308-308/? A/DEBUG: #04 pc 0016ecbb /system/lib/libart-compiler.so 02-13 07:22:10.088 308-308/? A/DEBUG: #05 pc 0016f4e7 /system/lib/libart-compiler.so (_ZNK3art13QuickCompiler7CompileEPKNS_7DexFile8CodeItemEjNS_10InvokeTypeEtjP8_jobjectRKS1_+1390) 02-13 07:22:10.088 308-308/? A/DEBUG: #06 pc 0031ed97 /system/lib/libart-compiler.so (_ZN3art14TryFastCompileEPNS_14CompilerDriverEPNS_8CompilerEPKNS_7DexFile8CodeItemEjNS_10InvokeTypeEtjP8_jobjectRKS4_+166) 02-13 07:22:10.088 308-308/? A/DEBUG: #07 pc 0025e279 /system/lib/libart-compiler.so (_ZNK3art18OptimizingCompiler7CompileEPKNS_7DexFile8CodeItemEjNS_10InvokeTypeEtjP8_jobjectRKS1_+180) 02-13 07:22:10.088 308-308/? A/DEBUG: #08 pc 001cb7ef /system/lib/libart-compiler.so (_ZN3art14CompilerDriver13CompileMethodEPNS_6ThreadEPKNS_7DexFile8CodeItemEjNS_10InvokeTypeEtjP8_jobjectRKS3_NS_24DexToDexCompilationLevelEb+1818) 02-13 07:22:10.088 308-308/? A/DEBUG: #09 pc 001cc49b /system/lib/libart-compiler.so (_ZN3art14CompilerDriver12CompileClassEPKNS_26ParallelCompilationManagerEj+1954) 02-13 07:22:10.088 308-308/? A/DEBUG: #10 pc 001c2c95 /system/lib/libart-compiler.so 02-13 07:22:10.088 308-308/? A/DEBUG: #11 pc 00347e11 /system/lib/libart.so (_ZN3art16ThreadPoolWorker3RunEv+256) 02-13 07:22:10.089 308-308/? A/DEBUG: #12 pc 00348449 /system/lib/libart.so (_ZN3art16ThreadPoolWorker8CallbackEPv+52) 02-13 07:22:10.089 308-308/? A/DEBUG: #13 pc 0004169b /system/lib/libc.so (_ZL15__pthread_startPv+30) 02-13 07:22:10.089 308-308/? A/DEBUG: #14 pc 00019275 /system/lib/libc.so (__start_thread+6) 02-13 07:22:10.366 308-308/? A/DEBUG: Tombstone written to: /data/tombstones/tombstone_09
02-13 09:06:16.369 8032-8032/? E/AndroidRuntime: FATAL EXCEPTION: main Process: com.tcl.antivirus, PID: 8032 java.lang.RuntimeException: Unable to start receiver com.antivirus.ui.privacy.PrivacyAlarmReceiver: java.lang.SecurityException: Permission Denial: opening provider com.android.providers.contacts.CallLogProvider from ProcessRecord{6dab055 8032:com.tcl.antivirus/u0a88} (pid=8032, uid=10088) requires android.permission.READ_CALL_LOG or android.permission.WRITE_CALL_LOG at android.app.ActivityThread.handleReceiver(ActivityThread.java:2732) at android.app.ActivityThread.access$1800(ActivityThread.java:150) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1421) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:148) at android.app.ActivityThread.main(ActivityThread.java:5417) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) Caused by: java.lang.SecurityException: Permission Denial: opening provider com.android.providers.contacts.CallLogProvider from ProcessRecord{6dab055 8032:com.tcl.antivirus/u0a88} (pid=8032, uid=10088) requires android.permission.READ_CALL_LOG or android.permission.WRITE_CALL_LOG at android.os.Parcel.readException(Parcel.java:1620) at android.os.Parcel.readException(Parcel.java:1573) at android.app.ActivityManagerProxy.getContentProvider(ActivityManagerNative.java:3572) at android.app.ActivityThread.acquireProvider(ActivityThread.java:4778) at android.app.ContextImpl$ApplicationContentResolver.acquireUnstableProvider(ContextImpl.java:2018) at android.content.ContentResolver.acquireUnstableProvider(ContentResolver.java:1471) at android.content.ContentResolver.query(ContentResolver.java:477) at android.content.ContentResolver.query(ContentResolver.java:435) at com.antivirus.i.a(Unknown Source) at com.antivirus.privacy.e.b(Unknown Source) at com.antivirus.privacy.e.a(Unknown Source) at com.antivirus.ui.privacy.PrivacyAlarmReceiver.a(Unknown Source) at com.antivirus.ui.privacy.PrivacyAlarmReceiver.onReceive(Unknown Source) at android.app.ActivityThread.handleReceiver(ActivityThread.java:2725) at android.app.ActivityThread.access$1800(ActivityThread.java:150) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1421) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:148) at android.app.ActivityThread.main(ActivityThread.java:5417) at java.lang.reflect.Method.invoke(Native Method)
发布于 2021-02-25 16:33:02
我直接在使用android版本9的手机上测试了这个应用程序,错误是我将一张图片添加到了错误的资源目录中。因此,我将图片的位置从mipmap更改为drawable
感谢你的帮助
发布于 2021-02-15 01:16:38
这里有一个权限问题,在低版本的Android中,当你安装应用程序时,它会保证所有的权限,但在最新的Android API中,你必须在运行时请求权限,如果你不这样做,例如尝试读取应用程序的存储信息,那么你的应用程序将崩溃
https://stackoverflow.com/questions/66179057
复制