我正在用Google地图在应用程序中创建旅游应用程序。我的应用程序可以在Android 7.1和更高版本上完美运行,但是当我在Android 7.0和更高版本上安装时,出现问题“ [[App Name]]不幸停止工作”。
我正在使用compileSdkVersion=25 , minSDK=14 and targetSDK=28
(我尝试将其更改为SDK 21、22、23,但注意到有效)。
这是我的构建gradle文件,
compileSdkVersion 25
buildToolsVersion "29.0.1"
defaultConfig {
applicationId "com.stefanovski.bojan.bitolaguide"
minSdkVersion 14
targetSdkVersion 28
versionCode 2
versionName "1.1"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
manifestPlaceholders = [googleMapsKey: 'AIzaSyDCwHrHPFZmIMfqKlmmYIstb4exYAhYMgU']
}
}
android {
aaptOptions {
cruncherEnabled = false
}
}
实际结果是,在7.1和更高版本的Android 7.1上都可以正常工作。
编辑:
这是我的应用崩溃的连接设备上的logcat
> 08-28 13:28:09.703 22375-22375/? E/Zygote: v2 08-28 13:28:09.703
> 22375-22375/? I/libpersona: KNOX_SDCARD checking this for 10226 08-28
> 13:28:09.703 22375-22375/? I/libpersona: KNOX_SDCARD not a persona
> 08-28 13:28:09.707 22375-22375/? E/Zygote: accessInfo : 0 08-28
> 13:28:09.712 22375-22375/? W/SELinux: SELinux
> selinux_android_compute_policy_index : Policy Index[2],
> Con:u:r:zygote:s0 RAM:SEPF_SECMOBILE_7.0_0010, [-1 -1 -1 -1 0 1] 08-28
> 13:28:09.715 22375-22375/? I/SELinux: SELinux: seapp_context_lookup:
> seinfo=untrusted, level=s0:c512,c768,
> pkgname=com.stefanovski.bojan.bitolaguide 08-28 13:28:09.722
> 22375-22375/? I/art: Late-enabling -Xcheck:jni 08-28 13:28:09.762
> 22375-22375/? D/TimaKeyStoreProvider: TimaKeyStore is not enabled:
> cannot add TimaSignature Service and generateKeyPair Service 08-28
> 13:28:09.878 22375-22375/com.stefanovski.bojan.bitolaguide W/System:
> ClassLoader referenced unknown path:
> /data/app/com.stefanovski.bojan.bitolaguide-1/lib/arm64 08-28
> 13:28:09.968 22375-22375/com.stefanovski.bojan.bitolaguide W/art:
> Before Android 4.1, method android.graphics.PorterDuffColorFilter
> android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter,
> android.content.res.ColorStateList, android.graphics.PorterDuff$Mode)
> would have incorrectly overridden the package-private method in
> android.graphics.drawable.Drawable 08-28 13:28:10.603
> 22375-22375/com.stefanovski.bojan.bitolaguide
> D/ViewRootImpl@5abccb1[SplashScreen]: ThreadedRenderer.create()
> translucent=false 08-28 13:28:10.617
> 22375-22375/com.stefanovski.bojan.bitolaguide D/InputTransport: Input
> channel constructed: fd=57 08-28 13:28:10.618
> 22375-22375/com.stefanovski.bojan.bitolaguide
> D/ViewRootImpl@5abccb1[SplashScreen]: setView =
> DecorView@46a4596[SplashScreen] touchMode=true 08-28 13:28:10.625
> 22375-22375/com.stefanovski.bojan.bitolaguide
> D/ViewRootImpl@5abccb1[SplashScreen]: dispatchAttachedToWindow 08-28
> 13:28:10.672 22375-22375/com.stefanovski.bojan.bitolaguide
> D/ViewRootImpl@5abccb1[SplashScreen]: Relayout returned:
> oldFrame=[0,0][0,0] newFrame=[0,0][1440,2560] result=0x27
> surface={isValid=true 490731848192} surfaceGenerationChanged=true
> 08-28 13:28:10.673 22375-22375/com.stefanovski.bojan.bitolaguide
> D/ViewRootImpl@5abccb1[SplashScreen]: mHardwareRenderer.initialize()
> mSurface={isValid=true 490731848192} hwInitialized=true 08-28
> 13:28:10.697 22375-22375/com.stefanovski.bojan.bitolaguide
> D/ViewRootImpl@5abccb1[SplashScreen]: MSG_RESIZED_REPORT: ci=Rect(0,
> 96 - 0, 0) vi=Rect(0, 96 - 0, 0) or=1 08-28 13:28:10.697
> 22375-22375/com.stefanovski.bojan.bitolaguide
> D/ViewRootImpl@5abccb1[SplashScreen]: MSG_WINDOW_FOCUS_CHANGED 1 08-28
> 13:28:10.697 22375-22375/com.stefanovski.bojan.bitolaguide
> D/ViewRootImpl@5abccb1[SplashScreen]:
> mHardwareRenderer.initializeIfNeeded()#2 mSurface={isValid=true
> 490731848192} 08-28 13:28:10.699
> 22375-22375/com.stefanovski.bojan.bitolaguide V/InputMethodManager:
> Starting input: tba=android.view.inputmethod.EditorInfo@a778517 nm :
> com.stefanovski.bojan.bitolaguide ic=null 08-28 13:28:10.699
> 22375-22375/com.stefanovski.bojan.bitolaguide I/InputMethodManager:
> [IMM] startInputInner - mService.startInputOrWindowGainedFocus 08-28
> 13:28:10.713 22375-22403/com.stefanovski.bojan.bitolaguide D/libEGL:
> loaded /vendor/lib64/egl/libGLES_mali.so 08-28 13:28:10.714
> 22375-22388/com.stefanovski.bojan.bitolaguide D/InputTransport: Input
> channel constructed: fd=58 08-28 13:28:10.748
> 22375-22403/com.stefanovski.bojan.bitolaguide I/OpenGLRenderer:
> Initialized EGL, version 1.4 08-28 13:28:10.748
> 22375-22403/com.stefanovski.bojan.bitolaguide D/OpenGLRenderer: Swap
> behavior 1 08-28 13:28:10.755
> 22375-22403/com.stefanovski.bojan.bitolaguide D/mali_winsys: EGLint
> new_window_surface(egl_winsys_display*, void*, EGLSurface, EGLConfig,
> egl_winsys_surface**, egl_color_buffer_format*, EGLBoolean) returns
> 0x3000, [1440x2560]-format:1 08-28 13:28:10.761
> 22375-22375/com.stefanovski.bojan.bitolaguide D/AndroidRuntime:
> Shutting down VM 08-28 13:28:10.769
> 22375-22375/com.stefanovski.bojan.bitolaguide E/AndroidRuntime: FATAL
> EXCEPTION: main Process: com.stefanovski.bojan.bitolaguide, PID: 22375
> java.lang.RuntimeException: Canvas: trying to draw too
> large(132710400bytes) bitmap. at
> android.view.DisplayListCanvas.throwIfCannotDraw(DisplayListCanvas.java:260)
> at android.graphics.Canvas.drawBitmap(Canvas.java:1420) at
> android.graphics.drawable.BitmapDrawable.draw(BitmapDrawable.java:545)
> at android.view.View.getDrawableRenderNode(View.java:18585) at
> android.view.View.drawBackground(View.java:18521) at
> android.view.View.draw(View.java:18309) at
> android.view.View.updateDisplayListIfDirty(View.java:17296) at
> android.view.View.draw(View.java:18080) at
> android.view.ViewGroup.drawChild(ViewGroup.java:3966) at
> android.view.ViewGroup.dispatchDraw(ViewGroup.java:3752) at
> android.view.View.updateDisplayListIfDirty(View.java:17291) at
> android.view.View.draw(View.java:18080) at
> android.view.ViewGroup.drawChild(ViewGroup.java:3966) at
> android.view.ViewGroup.dispatchDraw(ViewGroup.java:3752) at
> android.view.View.updateDisplayListIfDirty(View.java:17291) at
> android.view.View.draw(View.java:18080) at
> android.view.ViewGroup.drawChild(ViewGroup.java:3966) at
> android.view.ViewGroup.dispatchDraw(ViewGroup.java:3752) at
> android.view.View.updateDisplayListIfDirty(View.java:17291) at
> android.view.View.draw(View.java:18080) at
> android.view.ViewGroup.drawChild(ViewGroup.java:3966) at
> android.view.ViewGroup.dispatchDraw(ViewGroup.java:3752) at
> android.view.View.updateDisplayListIfDirty(View.java:17291) at
> android.view.View.draw(View.java:18080) at
> android.view.ViewGroup.drawChild(ViewGroup.java:3966) at
> android.view.ViewGroup.dispatchDraw(ViewGroup.java:3752) at
> android.view.View.draw(View.java:18321) at
> com.android.internal.policy.DecorView.draw(DecorView.java:919) at
> android.view.View.updateDisplayListIfDirty(View.java:17296) at
> android.view.ThreadedRenderer.updateViewTreeDisplayList(ThreadedRenderer.java:692)
> at
> android.view.ThreadedRenderer.updateRootDisplayList(ThreadedRenderer.java:698)
> at android.view.ThreadedRenderer.draw(ThreadedRenderer.java:806) at
> android.view.ViewRootImpl.draw(ViewRootImpl.java:3128) at
> android.view.ViewRootImpl.performDraw(ViewRootImpl.java:2924) at
> android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2516) at
> android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1515) at
> android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7091)
> at
> android.view.Choreographer$CallbackRecord.run(Choreographer.java:927)
> at android.view.Choreographer.doCallbacks(Choreographer.java:702) at
> android.view.Choreographer.doFrame(Choreographer.java:638) at
> android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:913)
> at android.os.Handler.handleCallback(Handler.java:751) at
> android.os.Handler.dispatchMessage(Handler.java:95) at
> android.os.Looper.loop(Looper.java:154) at
> android.app.ActivityThread.main(ActivityThread.java:6682) at
> java.lang.reflect.Method.invoke(Native Method) at
> com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1520)
> at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1410)
答案 0 :(得分:0)
我对cruncherEnabled = false
的使用方式有疑问。
您有RuntimeException
说:
画布:尝试绘制太大的(132710400bytes)位图。
使用选项cruncherEnabled = false
,可以防止在构建过程中可能会影响某些设备的图像优化。如果要防止对某些特定图像进行优化,请将其放在原始资源目录中,但在构建时不要禁用启动器。