简体   繁体   English

android studio调试版本运行良好,但发行版本崩溃

[英]android studio debug variant runs well but release version crashing

My app had been working perfectly until recent update of android studio. 在最近更新android studio之前,我的应用一直运行良好。 In this latest version of android studio, release variant with debuggable set to false crashes the app and with debuggable set to true runs perfect. 在此最新版本的android studio中,可调试设置为false的发行版本会使应用崩溃,而可调试设置为true的应用程序运行完美。

The difference between the two runs is debuggable flag in 两次运行之间的区别是在

buildTypes {
        release {
            debuggable true
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            signingConfig signingConfigs.config
        }
        debug {
            signingConfig signingConfigs.config
        }

Below is the logcat information when app crashes. 以下是应用程序崩溃时的logcat信息。

05-04 20:43:31.085 803-1821/? I/ActivityManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.guruvashishta.astrology.sample/.MainActivity} from uid 2000 from pid 15071 on display 0
05-04 20:43:31.093 803-1821/? V/WindowManager: Set focused app to: AppWindowToken{402b7ab token=Token{e74006d ActivityRecord{164e084 u0 com.guruvashishta.astrology.sample/.MainActivity t41876}}} old focus=AppWindowToken{c540a7c token=Token{adb9d6f ActivityRecord{5d8a84e u0 com.mofirst.launcher/.Launcher t41843}}} moveFocusNow=true
05-04 20:43:31.093 803-842/? D/ViewRootImpl: hardware acceleration is disabled, fakeHwAccelerated = true, HardwareRenderer.sRendererDisabled = false, forceHwAccelerated = false, HardwareRenderer.sSystemRendererDisabled = false, this = ViewRoot{2607e08 Starting com.guruvashishta.astrology.sample,ident = 33}
05-04 20:43:31.094 803-1821/? V/WindowManager: Looking for focus: 7 = Window{e529723 u0 StatusBar}, flags=-2122055608, canReceive=false
    findFocusedWindow: Reached focused app=AppWindowToken{402b7ab token=Token{e74006d ActivityRecord{164e084 u0 com.guruvashishta.astrology.sample/.MainActivity t41876}}}
05-04 20:43:31.097 803-842/? D/WindowManager: addWindowToListInOrderLocked: win=Window{a5097c6 u0 Starting com.guruvashishta.astrology.sample} Callers=com.android.server.wm.WindowManagerService.addWindow:2722 com.android.server.wm.Session.addToDisplay:171 android.view.ViewRootImpl.setView:645 android.view.WindowManagerGlobal.addView:319 
05-04 20:43:31.098 803-817/? D/AppOps: noteOperation: allowing code 59 uid 10166 package com.guruvashishta.astrology.sample
    noteOperation: allowing code 60 uid 10166 package com.guruvashishta.astrology.sample
05-04 20:43:31.110 803-817/? I/ActivityManager: Start proc 15086:com.guruvashishta.astrology.sample/u0a166 for activity com.guruvashishta.astrology.sample/.MainActivity
05-04 20:43:31.117 204-204/? I/BufferQueueConsumer: [unnamed-204-262](this:0xb84f0a10,id:262,api:0,p:-1,c:204) connect(C): consumer=(204:/system/bin/surfaceflinger) controlledByApp=false
    [unnamed-204-262](this:0xb84f0a10,id:262,api:0,p:-1,c:204) setConsumerName: unnamed-204-262
    [Starting com.guruvashishta.astrology.sample](this:0xb84f0a10,id:262,api:0,p:-1,c:204) setConsumerName: Starting com.guruvashishta.astrology.sample
05-04 20:43:31.118 204-204/? I/BufferQueueConsumer: [Starting com.guruvashishta.astrology.sample](this:0xb84f0a10,id:262,api:0,p:-1,c:204) setDefaultBufferSize: width=1 height=1
05-04 20:43:31.119 803-842/? V/WindowManager: findFocusedWindow: Reached focused app=AppWindowToken{402b7ab token=Token{e74006d ActivityRecord{164e084 u0 com.guruvashishta.astrology.sample/.MainActivity t41876}}}
05-04 20:43:31.126 204-204/? I/BufferQueueConsumer: [Starting com.guruvashishta.astrology.sample](this:0xb84f0a10,id:262,api:0,p:-1,c:204) setDefaultBufferSize: width=480 height=854
05-04 20:43:31.130 204-874/? I/BufferQueueProducer: [Starting com.guruvashishta.astrology.sample](this:0xb84f0a10,id:262,api:2,p:803,c:204) connect(P): api=2 producer=(803:system_server) producerControlledByApp=false
05-04 20:43:31.130 204-394/? I/BufferQueueProducer: [Starting com.guruvashishta.astrology.sample](this:0xb84f0a10,id:262,api:2,p:803,c:204) new GraphicBuffer needed
05-04 20:43:31.256 15086-15086/? W/System: ClassLoader referenced unknown path: /data/app/com.guruvashishta.astrology.sample-2/lib/arm
05-04 20:43:31.257 15086-15086/? D/ActivityThread: BIND_APPLICATION handled : 0 / AppBindData{appInfo=ApplicationInfo{fa693b com.guruvashishta.astrology.sample}}
05-04 20:43:31.258 15086-15086/? V/ActivityThread: Handling launch of ActivityRecord{550f858 token=android.os.BinderProxy@b34bdb1 {com.guruvashishta.astrology.sample/com.guruvashishta.astrology.sample.MainActivity}} startsNotResumed=false
05-04 20:43:31.267 15086-15086/? V/ActivityThread: ActivityRecord{550f858 token=android.os.BinderProxy@b34bdb1 {com.guruvashishta.astrology.sample/com.guruvashishta.astrology.sample.MainActivity}}: app=android.app.Application@29c5e17, appName=com.guruvashishta.astrology.sample, pkg=com.guruvashishta.astrology.sample, comp={com.guruvashishta.astrology.sample/com.guruvashishta.astrology.sample.MainActivity}, dir=/data/app/com.guruvashishta.astrology.sample-2/base.apk
05-04 20:43:31.378 15086-15086/? E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.guruvashishta.astrology.sample, PID: 15086
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.guruvashishta.astrology.sample/com.guruvashishta.astrology.sample.MainActivity}: java.lang.ArrayIndexOutOfBoundsException: length=0; index=0
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2572)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2654)
        at android.app.ActivityThread.-wrap11(ActivityThread.java)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1488)
        at android.os.Handler.dispatchMessage(Handler.java:111)
        at android.os.Looper.loop(Looper.java:207)
        at android.app.ActivityThread.main(ActivityThread.java:5728)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:679)
     Caused by: java.lang.ArrayIndexOutOfBoundsException: length=0; index=0
        at swisseph.SwissEph.app_pos_etc_sun(SwissEph.java:5875)
        at swisseph.SwissEph.main_planet(SwissEph.java:3658)
        at swisseph.SwissEph.swecalc(SwissEph.java:3085)
        at swisseph.SwissEph._calc(SwissEph.java:420)
        at swisseph.SwissEph.swe_calc(SwissEph.java:318)
        at swisseph.SwissEph.swe_calc_ut(SwissEph.java:273)
        at com.guruvashishta.astrology.sample.MainActivity.onCreate(MainActivity.java:31)
        at android.app.Activity.performCreate(Activity.java:6337)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1113)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2519)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2654) 
        at android.app.ActivityThread.-wrap11(ActivityThread.java) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1488) 
        at android.os.Handler.dispatchMessage(Handler.java:111) 
        at android.os.Looper.loop(Looper.java:207) 
        at android.app.ActivityThread.main(ActivityThread.java:5728) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:679) 
05-04 20:43:31.381 803-2196/? W/ActivityManager:   Force finishing activity com.guruvashishta.astrology.sample/.MainActivity
05-04 20:43:31.384 803-2196/? V/WindowManager: Set focused app to: AppWindowToken{c540a7c token=Token{adb9d6f ActivityRecord{5d8a84e u0 com.mofirst.launcher/.Launcher t41843}}} old focus=AppWindowToken{402b7ab token=Token{e74006d ActivityRecord{164e084 u0 com.guruvashishta.astrology.sample/.MainActivity t41876}}} moveFocusNow=true
05-04 20:43:31.392 803-15099/? D/AES: ExceptionLog: notify aed
        process : com.guruvashishta.astrology.sample
05-04 20:43:31.392 803-15099/? D/AES:      module : com.guruvashishta.astrology.sample v1 (1.0)
          cause : data_app_crash
          pid : 15086
05-04 20:43:31.393 803-15099/? D/AEE/LIBAEE: shell: raise_exp(4, 15086, -1361051648, com.guruvashishta.astrology.sample, 0x0xb882c7a0, 0x0x0)
    shell: connected with AED OK
05-04 20:43:31.396 15100-15100/? I/AEE/AED: [OnPurpose Redunant in void preset_info(aed_report_record*, int, int)] pid: 15086, tid: -1361051648, name: UNKNOWN  >>> com.guruvashishta.astrology.sample <<<
05-04 20:43:31.396 15100-15100/? V/AEE/AED: dashboard_record_update() : rec->module = com.guruvashishta.astrology.sample 
05-04 20:43:31.423 803-838/? D/ViewRootImpl: hardware acceleration is enabled, this = ViewRoot{6dd0fbd Application Error: com.guruvashishta.astrology.sample,ident = 34}
05-04 20:43:31.425 803-838/? D/WindowManager: addWindowToListInOrderLocked: win=Window{f993d03 u0 Application Error: com.guruvashishta.astrology.sample} Callers=com.android.server.wm.WindowManagerService.addWindow:2722 com.android.server.wm.Session.addToDisplay:171 android.view.ViewRootImpl.setView:645 android.view.WindowManagerGlobal.addView:319 
05-04 20:43:31.425 803-838/? V/WindowManager: Free window: Adding window Window{f993d03 u0 Application Error: com.guruvashishta.astrology.sample} at 7 of 9
    Looking for focus: 9 = Window{e529723 u0 StatusBar}, flags=-2122055608, canReceive=false
    findFocusedWindow: Found new focus @ 7 = Window{f993d03 u0 Application Error: com.guruvashishta.astrology.sample}
05-04 20:43:31.426 803-838/? V/WindowManager: Changing focus from null to Window{f993d03 u0 Application Error: com.guruvashishta.astrology.sample} Callers=com.android.server.wm.WindowManagerService.addWindow:2762 com.android.server.wm.Session.addToDisplay:171 android.view.ViewRootImpl.setView:645 android.view.WindowManagerGlobal.addView:319 
05-04 20:43:31.426 803-838/? D/WindowManager: Input focus has changed to Window{f993d03 u0 Application Error: com.guruvashishta.astrology.sample}
05-04 20:43:31.426 803-842/? I/WindowManager: Focus moving from null to Window{f993d03 u0 Application Error: com.guruvashishta.astrology.sample}
05-04 20:43:31.427 803-842/? I/WindowManager: Gaining focus: Window{f993d03 u0 Application Error: com.guruvashishta.astrology.sample}
05-04 20:43:31.443 204-204/? I/BufferQueueConsumer: [unnamed-204-263](this:0xb84edc90,id:263,api:0,p:-1,c:204) setConsumerName: unnamed-204-263
    [Application Error: com.guruvashishta.astrology.sample](this:0xb84edc90,id:263,api:0,p:-1,c:204) setConsumerName: Application Error: com.guruvashishta.astrology.sample
05-04 20:43:31.443 204-204/? I/BufferQueueConsumer: [Application Error: com.guruvashishta.astrology.sample](this:0xb84edc90,id:263,api:0,p:-1,c:204) setDefaultBufferSize: width=97 height=97
05-04 20:43:31.449 803-838/? V/WindowManager: Looking for focus: 9 = Window{e529723 u0 StatusBar}, flags=-2122055608, canReceive=false
    findFocusedWindow: Found new focus @ 7 = Window{f993d03 u0 Application Error: com.guruvashishta.astrology.sample}
05-04 20:43:31.456 204-204/? I/BufferQueueConsumer: [Application Error: com.guruvashishta.astrology.sample](this:0xb84edc90,id:263,api:0,p:-1,c:204) setDefaultBufferSize: width=576 height=316
05-04 20:43:31.460 803-875/? D/OpenGLRenderer: CanvasContext() 0xb8801778 initialize window=0xb87e0150, title=Application Error: com.guruvashishta.astrology.sample
05-04 20:43:31.462 204-5725/? I/BufferQueueProducer: [Application Error: com.guruvashishta.astrology.sample](this:0xb84edc90,id:263,api:1,p:803,c:204) connect(P): api=1 producer=(803:system_server) producerControlledByApp=false
05-04 20:43:31.463 204-874/? D/BufferQueueProducer: [Application Error: com.guruvashishta.astrology.sample](this:0xb84edc90,id:263,api:1,p:803,c:204) allocateBuffers: allocating from 3 buffers up to 3 buffers
05-04 20:43:31.463 204-5725/? I/BufferQueueProducer: [Application Error: com.guruvashishta.astrology.sample](this:0xb84edc90,id:263,api:1,p:803,c:204) setBufferCount: count = 4
05-04 20:43:31.465 204-5725/? I/BufferQueueConsumer: [Application Error: com.guruvashishta.astrology.sample](this:0xb84edc90,id:263,api:1,p:803,c:204) getReleasedBuffers: returning mask 0xffffffffffffffff
05-04 20:43:31.469 204-1533/? I/BufferQueueProducer: [Application Error: com.guruvashishta.astrology.sample](this:0xb84edc90,id:263,api:1,p:803,c:204) new GraphicBuffer needed
05-04 20:43:31.480 204-1533/? I/BufferQueueProducer: [Application Error: com.guruvashishta.astrology.sample](this:0xb84edc90,id:263,api:1,p:803,c:204) new GraphicBuffer needed
05-04 20:43:31.906 803-837/? W/ActivityManager: Activity pause timeout for ActivityRecord{164e084 u0 com.guruvashishta.astrology.sample/.MainActivity t41876 f}
05-04 20:43:31.920 803-835/? V/WindowManager: Looking for focus: 9 = Window{e529723 u0 StatusBar}, flags=-2122055608, canReceive=false
    findFocusedWindow: Found new focus @ 7 = Window{f993d03 u0 Application Error: com.guruvashishta.astrology.sample}
05-04 20:43:32.013 803-842/? V/WindowManager: Looking for focus: 9 = Window{e529723 u0 StatusBar}, flags=-2122055608, canReceive=false
    findFocusedWindow: Found new focus @ 7 = Window{f993d03 u0 Application Error: com.guruvashishta.astrology.sample}
05-04 20:43:32.019 803-842/? V/WindowManager: findFocusedWindow: Found new focus @ 7 = Window{f993d03 u0 Application Error: com.guruvashishta.astrology.sample}
05-04 20:43:32.447 803-842/? V/WindowManager: Looking for focus: 9 = Window{e529723 u0 StatusBar}, flags=-2122055608, canReceive=false
    findFocusedWindow: Found new focus @ 7 = Window{f993d03 u0 Application Error: com.guruvashishta.astrology.sample}
05-04 20:43:32.448 204-1533/? I/BufferQueueProducer: [Starting com.guruvashishta.astrology.sample](this:0xb84f0a10,id:262,api:2,p:-1,c:204) disconnect(P): api 2
05-04 20:43:32.449 204-1533/? I/BufferQueueConsumer: [Starting com.guruvashishta.astrology.sample](this:0xb84f0a10,id:262,api:2,p:-1,c:204) getReleasedBuffers: returning mask 0xffffffffffffffff
05-04 20:43:32.462 204-204/? I/BufferQueueConsumer: [Starting com.guruvashishta.astrology.sample](this:0xb84f0a10,id:262,api:2,p:-1,c:-1) disconnect(C)
05-04 20:43:32.463 204-204/? I/BufferQueue: [Starting com.guruvashishta.astrology.sample](this:0xb84f0a10,id:262,api:2,p:-1,c:-1) ~BufferQueueCore
05-04 20:43:33.061 204-394/? I/BufferQueueProducer: [Application Error: com.guruvashishta.astrology.sample](this:0xb84edc90,id:263,api:1,p:803,c:204) queueBuffer: fps=1.89 dur=1584.04 max=946.13 min=6.97
05-04 20:43:42.019 803-837/? W/ActivityManager: Activity destroy timeout for ActivityRecord{164e084 u0 com.guruvashishta.astrology.sample/.MainActivity t41876 f}

Seems the trouble is in MainActivity.java , row 31. 看来问题出在MainActivity.java第31行。

In logcat I can see the cause of the exception is in MainActivity.onCreate() . 在logcat中,我可以看到异常的原因在MainActivity.onCreate()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM