android - 应用程序未构建 apk - MethodHandle.invoke 和 MethodHandle.invokeExact 仅支持从 Android O (--min-api 26) 开始
问题描述
我的应用程序在我的 android 手机 (android 10) 上运行良好。但是当我尝试构建 apk 时,构建并没有发生。如果我将 minSdk 更改为 26,它会构建得很好。但我想将应用程序构建为 minSdk 21。我不知道确切的问题是什么。请帮帮我。
它显示此错误消息。 在此处输入图像描述
这是我的应用程序级 gradle 代码
plugins {
id 'com.android.application'
}
android {
compileSdkVersion 30
buildToolsVersion '30.0.3'
defaultConfig {
applicationId "com.affable.ssmartbills"
minSdkVersion 21
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
packagingOptions {
exclude 'com/itextpdf/io/font/cmap_info.txt'
exclude 'com/itextpdf/io/font/cmap/*'
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
//animation
implementation 'com.airbnb.android:lottie:3.6.1'
//alternative for Shared-Pref
implementation 'io.paperdb:paperdb:2.7.1'
//Get SQLite from assets
implementation 'com.readystatesoftware.sqliteasset:sqliteassethelper:2.0.1'
//custom Toast
implementation 'com.github.GrenderG:Toasty:1.5.0'
//file or folder chooser
implementation 'com.github.hedzr:android-file-chooser:v1.2.0-final'
//import export as excel file
implementation 'com.ajts.androidmads.SQLite2Excel:library:1.0.4'
//run time permission
implementation 'com.karumi:dexter:6.2.2'
//circle img view
implementation 'de.hdodenhof:circleimageview:3.1.0'
//Bar-Code Scanner
//https://github.com/dm77/barcodescanner
implementation 'me.dm7.barcodescanner:zxing:1.9.13'
//Image-Picker
//https://android-arsenal.com/details/1/7055
implementation 'com.github.maayyaannkk:ImagePicker:1.0.9'
//iText-7 library
implementation 'com.itextpdf:itext7-core:7.1.3'
//pdf viewer
implementation 'com.github.barteksc:android-pdf-viewer:3.1.0-beta.1'
//mp chart
//https://github.com/PhilJay/MPAndroidChart
implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'
}
这是构建级别的gradle文件
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.2.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
maven { url "https://jitpack.io" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
解决方案
推荐阅读
- java - 从java中的文件中读取多行形成特定的行号
- command-line - Ghostscript 设置 - 将任何 jpg 转换为 pdf 时出错
- c# - 避免重复的 Dockerfile
- java - 多个 CSV 文件标题到 dB 没有 pojo
- javascript - 我可以用 javascript 更改 svg 元素的填充标签内的内容吗?
- selenium - 如何跟踪应用程序中保存/提交/编辑/删除表单的响应时间?
- android - 如何在片段中的 RecyclerView 中获取最后一个可见项目
- azure - 如何跟踪迭代开始日期后已添加到 sprint 中的 Azure 工作项?
- python - 在给定三角形网格的情况下查找对象的体积
- php - 无法更新 laravel 中的类别下拉菜单