問(wèn)題:
安裝完這個(gè)插件后,運(yùn)行?cordova run android??報(bào)錯(cuò)童擎。
報(bào)錯(cuò)信息:(注意粗體斜線的版本,我的報(bào)錯(cuò)是24)
BUILD FAILED in 30s3 actionable tasks: 1 executed, 2 up-to-date/Users/X/Documents/cordovaProject/App/platforms/android/gradlew: Command failed with exit code 1 Error output:FAILURE: Build failed with an exception.* What went wrong:Could not resolve all files for configuration ':app:debugCompileClasspath'.>?Could not resolve com.android.support:support-v4:24.1.1+. Required by: project :app > Failed to list versions for com.android.support:support-v4. > Unable to load Maven meta-data from https://jcenter.bintray.com/com/android/support/support-v4/maven-metadata.xml. > Could not get resource 'https://jcenter.bintray.com/com/android/support/support-v4/maven-metadata.xml'. > Could not GET 'https://jcenter.bintray.com/com/android/support/support-v4/maven-metadata.xml'. > Connect to jcenter.bintray.com:443 [jcenter.bintray.com/34.95.74.180] failed: connect timed out* Try:Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.* Get more help at https://help.gradle.orgBUILD FAILED in 30s
版本:
"cordova":"^9.0.0"
"cordova-android": "^8.1.0",
"cordova-plugin-x-socialsharing": "^5.6.8",
解決方法:
看了報(bào)錯(cuò)信息疮丛,大致感覺(jué)是版本的不統(tǒng)一問(wèn)題焕数。
1.打開(kāi)build.gradle全都改成24版本的如下。改完后運(yùn)行 cordova run android
2.發(fā)現(xiàn)報(bào)了另一個(gè)錯(cuò)跪楞,沒(méi)關(guān)系缀去,再把24版本改回原來(lái)的版本,再次運(yùn)行cordova run android
BUILD FAILED in 13s
23 actionable tasks: 3 executed, 20 up-to-date
/Users/X/Documents/cordovaProject/App/platforms/android/gradlew: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processDebugResources'.
> Android resource linking failed? /Users/X/Documents/cordovaProject/App/platforms/android/app/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml:344: error: resource android:attr/fontStyle not found.? /Users/X/Documents/cordovaProject/App/platforms/android/app/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml:344: error: resource android:attr/font not found.? /Users/X/Documents/cordovaProject/App/platforms/android/app/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml:344: error: resource android:attr/fontWeight not found.
? error: failed linking references.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 13s
3.成功