I am building an ionic capacitor app on VSC for android and wanted to push it to the android studio emulator with the command
ionic capacitor run android
This is the error message I receive when creating a gradle build
Execution failed for task ':capacitor-camera:compileDebugJavaWithJavac'.
This happens also with similar plugins (e.g. splash-screen). When I am not using a plugin, it works perfectly and I can see the app on the android studio emulator.
These are the versions I use for capacitor and android SDK:
Capacitor: v3
Android SDK Platform-Tools: v33
Android Emulator: v31.3.10
Gradle: 7.0
I also tried to update the version in my build.gradle, but the error keeps the same.
Does anyone of you have an idea of why this error happens?
Here is my build.gradle file:
android {
compileSdkVersion rootProject.ext.compileSdkVersion
defaultConfig {
applicationId "io.ionic.starter"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
aaptOptions {
// Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps.
// Default: https://android.googlesource.com/platform/frameworks/base/+/282e181b58cf72b6ca770dc7ca5f91f135444502/tools/aapt/AaptAssets.cpp#61
ignoreAssetsPattern '!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~'
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
flatDir{
dirs '../capacitor-cordova-android-plugins/src/main/libs', 'libs'
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
implementation project(':capacitor-android')
testImplementation "junit:junit:$junitVersion"
androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
implementation project(':capacitor-cordova-android-plugins')
}
apply from: 'capacitor.build.gradle'
try {
def servicesJSON = file('google-services.json')
if (servicesJSON.text) {
apply plugin: 'com.google.gms.google-services'
}
} catch(Exception e) {
logger.info("google-services.json not found, google-services plugin not applied. Push Notifications won't work")
}
1条答案
按热度按时间omtl5h9j1#
版本4的电容器插件用于电容器4。升级到电容器4或将插件降级到1.x版本。