Cannot inline bytecode built with JVM target 1.8 into bytecode that is being built with JVM target
android {
...
compileOptions {
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
kotlinOptions {
jvmTarget = "1.8"
}
}
Execution failed for task ':app:packagexxxxRelease'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> Unable to find EOCD signature
Execution failed for task ':app:packageGame_ZHRelease'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> java.lang.IllegalArgumentException (no error message)
依赖中添加了有关ABI
相关的配置,打包输出时,未指定ABI
版本
import com.android.build.OutputFile
static def releaseTime() {
return new Date().format("yyyyMMdd", TimeZone.getTimeZone("GMT+8"))
}
buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
applicationVariants.all { variant ->
variant.outputs.all { output ->
project.ext { appName = 'YourApkName' }
outputFileName = "${appName}-${output.getFilter(OutputFile.ABI)}-${variant.name}-${variant.versionName}.apk"
}
}
}
}
AAPT: error: failed to read PNG signature: file does not start with PNG signature.
在app/build.gradle文件中加以下代码后,重构项目
android {
compileSdkVersion 28
flavorDimensions "mode"
aaptOptions.cruncherEnabled = false
aaptOptions.useNewCruncher = false
defaultConfig {
}
An exception occurred applying plugin request [id: 'com.android.application']
> Failed to apply plugin 'com.android.internal.application'.
> Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8.
You can try some of the following options:
- changing the IDE settings.
- changing the JAVA_HOME environment variable.
- changing `org.gradle.java.home` in `gradle.properties`.
依次点击:File——>Project Struct——>SDK Location——>JDK location was moved to Gradle Settings
,在打开的对话框中,将Gradle JDK修改为11
The 'kotlin-android-extensions' Gradle plugin is deprecated. Please use this migration guide (https://goo.gle/kotlin-android-extensions-deprecation) to start working with View Binding (https://developer.android.com/topic/libraries/view-binding) and the 'kotlin-parcelize' plugin.
删除 apply plugin: 'kotlin-android-extensions'
使用binding赋值
binding.name.text = viewModel.nameString
Warning: Mapping new ns http://schemas.android.com/repository/android/common/02 to old ns http://schemas.android.com/repository/android/common/01
Warning: Mapping new ns http://schemas.android.com/repository/android/generic/02 to old ns http://schemas.android.com/repository/android/generic/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/02 to old ns http://schemas.android.com/sdk/android/repo/addon2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/02 to old ns http://schemas.android.com/sdk/android/repo/repository2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/02 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01
compileSdkVersion 30
buildToolsVersion "30.0.3"
compileSdkVersion 30
buildToolsVersion "30.0.2"
Task list not build
,进入Settings——>Experimental
,将Do not build Gradle task list duraing Gradle sync
前面的勾选去掉,并应用Sync Project with Gradle Files
同步一下项目