我在RN项目的android目录下执行了
./gradlew clean命令进行清理,但是报了如下的错误:
- What went wrong:
A problem occurred configuring project ':react-native-baidu-map'.
Could not resolve all files for configuration ':react-native-baidu-map:classpath'.
Could not find aapt2-proto-0.3.1.jar (com.android.tools.build:aapt2-proto:0.3.1).
Searched in the following locations:
https://maven.aliyun.com/repository/gradle-plugin/com/android/tools/build/aapt2-proto/0.3.1/aapt2-proto-0.3.1
我已经按照网上的解决办法把google()方法置顶了,但是依旧不行。
这是我的配置文件:
def safeExtGet(prop, fallback) {
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
}
apply plugin: 'com.android.library'
buildscript {
repositories {
google()
mavenLocal()
mavenCentral()
jcenter()
maven() {
allowInsecureProtocol true
url 'http://repo.lovebing.net/repository/maven-public/'
}
maven() { url 'https://maven.aliyun.com/repository/gradle-plugin/' }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.0'
}
}
repositories {
google()
mavenLocal()
mavenCentral()
jcenter()
maven {
allowInsecureProtocol true
url 'http://repo.lovebing.net/repository/maven-public/'
}
maven {
url 'https://maven.aliyun.com/repository/gradle-plugin/'
}
}
android {
compileSdkVersion safeExtGet('compileSdkVersion', 28)
buildToolsVersion safeExtGet('buildToolsVersion', '28.0.3')
defaultConfig {
minSdkVersion safeExtGet('minSdkVersion', 21)
targetSdkVersion safeExtGet('targetSdkVersion', 28)
versionCode 1
versionName "${version}"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
compileOnly 'com.facebook.react:react-native:0.62.2'
implementation files('libs/BaiduLBS_Android.jar')
compileOnly files('src/main/assets')
}
请问各位大神,还有什么别的解决办法吗?着急中...
如果您所提供的解决方案有效,我愿意奉上一个红包作为答谢。
这是stackover上找到的解决办法。
我按照截图上的说明,尝试把gradle:3.3.0降级成 3.1.0,能够正常同步到那个库了。