Not Able To Debug App In Android Studio

前端 未结 30 2680
小蘑菇
小蘑菇 2020-12-01 02:30

I am making an app in Android Studio, now trying to debug it through adb. When I click on the word Android and the logo on the bottom bar, logcat comes up and recognizes my

30条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-01 02:59

    In my case near any line a red circle appeared with a cross and red line with a message: "No executable code found at line ..." like in Android studio gradle breakpoint No executable code found at line.

    A problem appeared after updating of build.gradle. We included Kotlin support, so a number of methods exceeded 64K. Problem lines:

    buildTypes {
        debug {
            minifyEnabled true
    

    Change them to:

    buildTypes {
        debug {
            minifyEnabled false
            debuggable true
    

    Then sync a gradle with a button "Sync Project with Gradle Files". If after restarting of your application you will get an error: "Error:The number of method references in a .dex file cannot exceed 64K. Learn how to resolve this issue at https://developer.android.com/tools/building/multidex.html", then, like in The number of method references in a .dex file cannot exceed 64k API 17 add the following lines to build.gradle:

    android {
    
        defaultConfig {
            ...
    
            // Enabling multidex support.
            multiDexEnabled true
        }
        ...
    }
    
    dependencies {
        implementation 'com.android.support:multidex:1.0.2'
    }
    

    UPDATE

    According to https://developer.android.com/studio/build/multidex.html do the following to enable multidex support below Android 5.0. Else it won't start in these devices.

    Open AndroidManifest and find tag . Near android:name= is a reference to an Application class. Open this class. Extend Application class with MultiDexApplication so:

    public class MyApplication extends MultiDexApplication { ... }
    

    If no Application class set, write so:

    
        ...
    
    

提交回复
热议问题