我正在使用Emulator 7.1.1(Google Apis)
完全例外是

     E/AndroidRuntime: FATAL EXCEPTION: GLThread 309

 java.lang.RuntimeException: createContext failed: 12291
  at com.google.maps.api.android.lib6.gmm6.vector.bi.a(:com.google.android.gms.DynamiteModulesB:834)
  at com.google.maps.api.android.lib6.gmm6.vector.bj.f(:com.google.android.gms.DynamiteModulesB:20825)
  at com.google.maps.api.android.lib6.gmm6.vector.bj.run(:com.google.android.gms.DynamiteModulesB:881)

代码在samsung galaxy J5上运行良好,但在emulator上不工作。我已经在google上搜索过了,我浪费了2个小时在这个错误上,仍然找不到解决方案。任何帮助都将不胜感激。
我的build.gradle文件:
apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"

    dexOptions {
        javaMaxHeapSize "4g"
    }

    defaultConfig {
        applicationId "com.katariya.pomoc"
        minSdkVersion 15
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
        renderscriptTargetApi 18
        renderscriptSupportModeEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    testCompile 'junit:junit:4.12'
    compile 'com.mcxiaoke.volley:library-aar:1.0.0'
    compile 'com.android.support:appcompat-v7:25.3.0'
    compile 'com.android.support:design:25.3.0'
    compile 'com.android.support:recyclerview-v7:25.3.0'
    compile 'com.google.android.gms:play-services-maps:10.2.1'
    compile 'com.google.android.gms:play-services-location:10.2.1'
    compile 'com.google.android.gms:play-services-gcm:10.2.1'
    compile 'com.google.firebase:firebase-core:10.2.1'
    compile 'com.google.firebase:firebase-messaging:10.2.1'
    compile 'com.squareup.picasso:picasso:2.5.0'
    compile 'com.android.support:support-v4:25.3.0'
    compile 'com.android.support:multidex:1.0.0'
    compile 'commons-io:commons-io:2.4'

}
apply plugin: 'com.google.gms.google-services'

最佳答案

我得到了它!
我进入模拟器本身的设置,并将opengl es render从基于主机的自动检测(默认)更改为桌面本地opengl。在那之后,我的应用程序开始完美工作。这是一个清晰的截图,希望这有助于未来的人!
android - java.lang.RuntimeException:createContext失败:-LMLPHP

07-24 09:47
查看更多