Android Studio安装Cordova Ping插件时Gradle版本频繁重置
Hey there! I know getting started with Android Studio and Cordova can feel overwhelming when you hit these version errors—let's sort this out step by step.
Option 1: Manually Edit the Gradle Wrapper File (Direct & Reliable)
The error message already points you to the exact file to modify, so let's start here:
- Navigate to this file path on your computer:
/Users/sam/Development/Apps/ghost/gradle/wrapper/gradle-wrapper.properties - Open it with a text editor (like TextEdit or directly in Android Studio)
- Locate the line starting with
distributionUrl—it currently links to Gradle 4.1 - Replace that line with this:
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip - Save the file, then switch back to Android Studio. You’ll see a "Sync Now" prompt at the top—click it, and Android Studio will download the correct Gradle version and sync your project.
Option 2: Use Android Studio's Project Structure Menu (GUI Method)
You tried this menu already, so let’s make sure you’re navigating to the right spot:
- Go to
File > Project Structure(the menu you used before) - On the left sidebar, select Project (not "Modules"—this is a common mix-up for new users)
- On the right side, find the Gradle version dropdown. Select
4.4from the list (if it’s not visible, you can type "4.4" directly into the field) - Click OK—Android Studio will automatically update the
gradle-wrapper.propertiesfile and start syncing the project with the new Gradle version.
Quick Note for Cordova Projects
Since you’re working with a Cordova project, keep in mind that running cordova build android might overwrite your Gradle settings later. If you hit the same error again after building with Cordova, you may need to check your Cordova config or adjust Gradle settings in the platforms/android folder of your project. But let’s get the plugin installed first—once you’ve updated the Gradle version, try installing the Ping plugin again.
内容的提问来源于stack exchange,提问作者S_R

