Unable to instantiate application com.android.tools.fd.runtime.BootstrapApplication

Android Studio更新到最新的2.2.3 ,如果编译工具的配置为

android {
    useLibrary 'org.apache.http.legacy'
    compileSdkVersion 25
    buildToolsVersion '24.0.3'
    defaultConfig {
        applicationId "com.xxxx"
        minSdkVersion 16
        targetSdkVersion 23
        versionName "1.0.6"
        versionCode versionCodeThinkId

        ndk {
            // 设置支持的SO库架构
            abiFilters 'armeabi', 'x86'//, 'armeabi-v7a', 'x86_64', 'arm64-v8a'
            //
        }
        vectorDrawables.useSupportLibrary = true
        multiDexEnabled true

    }

这种情况下会出现这个bug, app启动直接闪退

修复方法:

更新至最新的build-tools

android {
    useLibrary 'org.apache.http.legacy'
    compileSdkVersion 25
    buildToolsVersion '25.0.2'
    defaultConfig {
        applicationId "com.xxxx"
        minSdkVersion 16
        targetSdkVersion 23
        versionName "1.0.6"
        versionCode versionCodeThinkId

        ndk {
            // 设置支持的SO库架构
            abiFilters 'armeabi', 'x86'//, 'armeabi-v7a', 'x86_64', 'arm64-v8a'
            //
        }
        vectorDrawables.useSupportLibrary = true
        multiDexEnabled true

    }

保证 compileSdkVersion 和 buildToolsVersion 的大版本号统一 ,修改之后,不会再出现了

发布了71 篇原创文章 · 获赞 25 · 访问量 37万+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章