开发Android应用同步Gradle依赖报错:Failed to resolve: redstone.xmlrpc:xmlrpc:1.1.1
Hey Paul, that dependency error is a common hiccup when using libraries that rely on artifacts not hosted in Android's default Google Repository. Let's get this sorted out quickly:
Step 1: Add the Required Repository
The redstone.xmlrpc:xmlrpc:1.1.1 artifact lives on Maven Central, which isn't always included by default in newer Android projects. You'll need to add this repository to your module-level build.gradle file (the one you shared):
Add this block outside of the android block in your build file:
repositories { google() mavenCentral() // This line tells Gradle where to find the missing xmlrpc library }
Step 2: Double-Check Your WordPress-Java Dependency
Make sure your dependency declaration for the wordpress-java library is properly included in the dependencies block (you didn't share this part, but it's critical):
dependencies { // ... your existing dependencies (like support libraries, etc.) implementation 'org.wordpress:wordpress-java:4.1.0' // Use the latest stable version available }
Why This Works
Android's default setup only pulls artifacts from the Google Repository by default. The redstone.xmlrpc library that wordpress-java depends on isn't hosted there—adding Maven Central gives Gradle the extra location it needs to fetch that missing dependency.
Full Modified Build.Gradle Snippet
Here's how your updated file should look (I also fixed the truncated proguard path in your release build type):
android { compileSdkVersion 27 defaultConfig { applicationId "com.paultoillion.myapplication" minSdkVersion 19 targetSdkVersion 27 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } // Added repository block repositories { google() mavenCentral() } dependencies { // ... your existing dependencies implementation 'org.wordpress:wordpress-java:4.1.0' }
After making these changes, sync your project with Gradle files—this should resolve the missing dependency error.
内容的提问来源于stack exchange,提问作者Paul Toillion

