我使用的是 ubuntu 16 android studio 2.3.3,设备平板电脑 5.1。在我的应用程序中,我有这些 grandle 文件....
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.0"
defaultConfig {
applicationId "com.example.bmeccoffice.remotehelp"
minSdkVersion 22
targetSdkVersion 22
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
jackOptions {
enabled true
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
incremental false
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:26.+'
compile 'com.android.support:design:26.+'
compile 'org.webrtc:google-webrtc:1.0.21217'
testCompile 'junit:junit:4.12'
}
我使用 5.1 设备(平板电脑)并尝试编译我的 symple 应用程序(实际上只有底部导航 Activity 布局......空......没有别的)但是我在调试期间有一长串 26 错误.. ..
Error:Lambda coming from jar file need their interfaces on the classpath to be compiled, unknown interfaces are android.graphics.SurfaceTexture$OnFrameAvailableListener
Error:Lambda coming from jar file need their interfaces on the classpath to be compiled, unknown interfaces are java.lang.RunnableError:Static method (these error 12 times)
org.webrtc.EglBase create() not supported in Android API level less than 24
Error:Static method org.webrtc.EglBase create(org.webrtc.EglBase$Context sharedContext, int[] configAttributes) not supported in Android API level less than 24
Error:Static method org.webrtc.EglBase create(org.webrtc.EglBase$Context sharedContext) not supported in Android API level less than 24
Error:Static method org.webrtc.EglBase createEgl10(int[] configAttributes) not supported in Android API level less than 24
Error:Static method org.webrtc.EglBase createEgl10(javax.microedition.khronos.egl.EGLContext sharedContext, int[] configAttributes) not supported in Android API level less than 24
Error:Static method org.webrtc.EglBase createEgl14(android.opengl.EGLContext sharedContext, int[] configAttributes) not supported in Android API level less than 24
Error:Static method org.webrtc.EglBase createEgl14(int[] configAttributes) not supported in Android API level less than 24
Error:Execution failed for task ':app:transformClassesWithPreJackPackagedLibrariesForDebug'.
> com.android.build.api.transform.TransformException: com.android.builder.core.JackToolchain$ToolchainException: Jack compilation exception
我刚刚修改了它(在支持 1_7 版本之前)....但是我有这些错误....如果使用 VERSION_1_7 && jackOptions == false 返回到旧版本...获得这 3 个错误:
Error:Error converting bytecode to dex:
Cause: Dex cannot parse version 52 byte code.
This is caused by library dependencies that have been compiled using Java 8 or above.
If you are using the 'java' gradle plugin in a library submodule add
targetCompatibility = '1.7'
sourceCompatibility = '1.7'
to that submodule's build.gradle file.
Error:1 error; aborting
Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
> com.android.build.api.transform.TransformException: java.lang.RuntimeException: java.lang.RuntimeException: Unable to pre-dex '/home/office/.android/build-cache/b4dd2b467a0ed596ad0e2a137856a6897964c81c/output/jars/classes.jar'
to '/home/office/AndroidStudioProjects/RemoteHelp2/app/build/intermediates /transforms/dex/debug/folders/1000/10 /classes_5110517f2feea04a1d9834af1ccaded1b5e9f0d5'
我有一个模块......一个外部库......但没有依赖......
我们需要使用 webrtc API。
有人建议如何解决这些错误?
编辑:
删除模块...没有任何变化...同样的错误。
最佳答案
之前我发布了错误的解决方案....更改 Gl 性能(硬件或软件)不是解决方案的一部分。
真正的解决办法是:
sudo apt-get install lib64stdc++6
在利用这些新功能后,我将 Android Studio 更新到版本 3.0.1。
所以 app->grandle.build 的正确部分是:
android {
compileSdkVersion 26
buildToolsVersion "26.0.2"
defaultConfig {
applicationId "com.example.bmeccoffice.remotehelp"
minSdkVersion 22
targetSdkVersion 22
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
jackOptions {
enabled true
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
incremental false
}
}
就是这样。
背景
关于java - android studio 3 (linux pc) java 1.8 上的 API 22 5.1 sdk 设备,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48226962/