我已经做了一个由 cordova 和 netbeans 的android项目...所有的工作都很好。
现在我想在Playstore上发布它,我已经看到,要发布它,我必须签署我的应用(https://developer.android.com/studio/publish/app-signing)...按照主题,似乎更简单的方法是在Android Studio中导入项目。
在使用Android Studio的Cordova文档(https://cordova.apache.org/docs/en/11.x/guide/platforms/android/index.html)之后,我打开了项目android(在“平台”文件夹内)...当Gradle同步开始时,我遇到了这些错误:
A problem occurred evaluating project ':CordovaLib'.
- Failed to apply plugin 'com.github.dcendents.android-maven'.
- Could not create plugin of type 'AndroidMavenPlugin'.
- Could not generate a decorated class for type AndroidMavenPlugin.
- org/gradle/api/publication/maven/internal/MavenPomMetaInfoProvider
还有
A problem occurred configuring project ':CordovaLib'.
compileSdkVersion is not specified. Please add it to build.gradle
这是我在android/cordovaLib/中的build.gradle文件
ext {
apply from: 'cordova.gradle'
cdvCompileSdkVersion = privateHelpers.getProjectTarget()
cdvBuildToolsVersion = privateHelpers.findLatestInstalledBuildTools()
if (project.hasProperty('cdvMinSdkVersion') && cdvMinSdkVersion.isInteger()) {
cdvMinSdkVersion = cdvMinSdkVersion as int
println '[Cordova] cdvMinSdkVersion is overridden, try it at your own risk.'
} else {
cdvMinSdkVersion = 22; // current Cordova's default
}
}
buildscript {
apply from: 'repositories.gradle'
repositories repos
dependencies {
// The gradle plugin and the maven plugin have to be updated after each version of Android
// studio comes out
classpath 'com.android.tools.build:gradle:4.0.0'
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
}
}
allprojects {
apply from: 'repositories.gradle'
repositories repos
}
apply plugin: 'com.android.library'
apply plugin: 'com.github.dcendents.android-maven'
apply plugin: 'com.jfrog.bintray'
group = 'org.apache.cordova'
version = '9.1.0'
android {
compileSdkVersion cdvCompileSdkVersion
buildToolsVersion cdvBuildToolsVersion
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
// For the Android Cordova Lib, we allow changing the minSdkVersion, but it is at the users own risk
defaultConfig {
minSdkVersion cdvMinSdkVersion
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
}
}
install {
repositories.mavenInstaller {
pom {
project {
packaging 'aar'
name 'Cordova'
url 'https://cordova.apache.org'
licenses {
license {
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id 'stevengill'
name 'Steve Gill'
}
}
scm {
connection 'scm:git:https://github.com/apache/cordova-android.git'
developerConnection 'scm:git:git@github.com:apache/cordova-android.git'
url 'https://github.com/apache/cordova-android'
}
}
}
}
}
task sourcesJar(type: Jar) {
from android.sourceSets.main.java.srcDirs
classifier = 'sources'
}
artifacts {
archives sourcesJar
}
bintray {
user = System.getenv('BINTRAY_USER')
key = System.getenv('BINTRAY_KEY')
configurations = ['archives']
pkg {
repo = 'maven'
name = 'cordova-android'
userOrg = 'cordova'
licenses = ['Apache-2.0']
vcsUrl = 'https://github.com/apache/cordova-android'
websiteUrl = 'https://cordova.apache.org'
issueTrackerUrl = 'https://github.com/apache/cordova-android/issues'
publicDownloadNumbers = true
licenses = ['Apache-2.0']
labels = ['android', 'cordova', 'phonegap']
version {
name = '9.1.0'
released = new Date()
vcsTag = '9.1.0'
}
}
}
我花了1天时间修复问题,但没有成功...例如:
- 卸载并重新安装Cordova的Android
- 更改Android版本
- 等...
在网络上,有些人说要更改buildscript依赖项
dependencies {
classpath 'com.android.tools.build:gradle:4.0.0'
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
}
但我的比他们的新...
有什么建议吗???
先谢了
1条答案
按热度按时间1zmg4dgp1#
完全相同的问题。我创建了一个测试项目Hello Cordova和构建崩溃,因为这个AndroidMavenPlugin。唯一的区别是我使用了CLI。什么himeric系统!没有最简单的项目那么Hello Cordova。