After Android Studio update: Gradle DSL method not found: 'runProguard()' - android

I've just updated my Android Studio and now my project won't build anymore. I get following error:
Error:(16, 0) Gradle DSL method not found: 'runProguard()'
Possible causes:<ul><li>The project 'App' may be using a version of Gradle that does not contain the method.
Gradle settings</li><li>The build file may be missing a Gradle plugin.
Apply Gradle plugin</li>
I didn't change anything, everything worked properly before the update. Here's my build.gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "20.0.0"
defaultConfig {
applicationId "com.ochs.pipette"
minSdkVersion 10
targetSdkVersion 21
versionCode 8
versionName "1.6"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:21.0.0'
compile 'it.sephiroth.android.library.imagezoom:library:1.0.4'
compile 'com.android.support:palette-v7:21.0.+'
}
And here's the other one:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0-rc2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
I don't know how to fix the problem, could anyone help me?

runProguard has been renamed minifyEnabled. See the changelog here for confirmation - version 0.14.0 (2014/10/31) of the Android Gradle plugin made the swap.

As #stkent said, runProguard has been renamed to minifyEnabled in version 0.14.0 (2014/10/31) of Gradle.
To fix this, you need to change runProguard to minifyEnabled in the build.gradle file of your project. For example,
buildTypes {
release {
runProguard false // Does not exist anymore...
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
would be replaced by
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
You can see other issues here but this worked for me.

runProguard has been renamed to minifyEnabled in version 0.14.0 (2014/10/31) of Gradle.
To fix this, you need to change runProguard to minifyEnabled in the build.gradle file of your project.

Related

Upgrading to Gradle version 4.0.0 broke R8 code shrinking

I have upgraded my gradle version to 4.0.0 from 3.6.3. Android Studio was able to install the app properly when minifyenabled was true and gradle version was 3.6.3 without any issues. On gradle version 4.0.0 and minifyenabled set to true doesn't even install the application. Here is what I see:
Installation did not succeed.
The application could not be installed: INSTALL_FAILED_INVALID_APK
List of apks:
[0] 'C:\Users\user\Desktop\Projects\Application\app\build\outputs\apk\debug\app-debug.apk'
[1] 'C:\Users\user\Desktop\Projects\Application\module1\build\outputs\apk\debug\module1-debug.apk'
[2] 'C:\Users\user\Desktop\Projects\Application\module2\build\outputs\apk\debug\module2-debug.apk'
[3] 'C:\Users\user\Desktop\Projects\Application\module3\build\outputs\apk\debug\module3-debug.apk'
[4] 'C:\Users\user\Desktop\Projects\Application\module4\build\outputs\apk\debug\module4-debug.apk'
[5] 'C:\Users\user\Desktop\Projects\Application\module5\build\outputs\apk\debug\module5-debug.apk'
The APKs are invalid.
build.gradle file:
android {
compileSdkVersion androidDependencies.compile_sdk_version
buildToolsVersion "29.0.3"
defaultConfig {
applicationId "com.pills.mydemoapplication"
minSdkVersion androidDependencies.min_sdk_version
targetSdkVersion androidDependencies.target_sdk_version
versionCode 7
versionName "5.0.2"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
kotlinOptions {
jvmTarget = "1.8"
}
buildTypes {
debug {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
buildFeatures{
dataBinding = true
}
dynamicFeatures = [":module1", ":module2", ":module3", ":module4", ":module5"]
}
Project level build.gradle
buildscript {
ext.kotlin_version = '1.3.72'
repositories {
google()
jcenter()
}
dependencies {
classpath "com.android.tools:r8:1.6.84"
classpath "com.android.tools.build:gradle:4.0.0"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:2.3.0-beta01"
}
}
Removing the following line from project level build.gradle made it work.
classpath "com.android.tools:r8:1.6.84"
R8 is now bundled with Android Gradle Plugin by default and the version of R8 in AGP is 2.0.74 and I was overriding it with a much older version which broke R8 code shrinking.
Make sure all your libraries and classpaths are up to date. I had a classpath for firebase-plugins that was out of date. This problem occurred when using the new gradle. After updating the classpath, everything looks fine.
In my case. I changed this
classpath 'com.google.firebase:firebase-plugins:1.1.0'
to this
classpath 'com.google.firebase:perf-plugin:1.3.1'

Unity Error: Minimum supported gradle version is 5.1.1

This is so frustrating and confusing! If anyone can help me understand what's wrong, I'd greatly appreciate it!
I'm building a Unity app, and per the directions from ironSource, I have to use a custom gradle template so I can set a couple of flags or whatever.
1. This is my Android Studio version:
2. This is the error I get when attempting to build in Unity:
3. This is the edited gradle-wrapper.properties file with 5.1.1-all set:
4. This is my mainTemplate.gradle
buildscript
{
repositories
{
google()
jcenter()
}
dependencies
{
classpath 'com.android.tools.build:gradle:3.4.1'
}
}
allprojects
{
repositories
{
google()
jcenter()
flatDir
{
dirs 'libs'
}
}
}
apply plugin: 'com.android.application'
dependencies
{
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.google.android.gms:play-services-ads-identifier:16.0.0'
implementation 'com.android.support:support-v4:27.1.1'
**DEPS**
implementation 'com.google.android.gms:play-services-ads:17.2.0'
}
android
{
compileSdkVersion **APIVERSION**
buildToolsVersion '**BUILDTOOLS**'
defaultConfig
{
targetSdkVersion **TARGETSDKVERSION**
applicationId '**APPLICATIONID**'
}
lintOptions
{
abortOnError false
}
aaptOptions
{
noCompress '.unity3d', '.ress', '.resource', '.obb'**STREAMING_ASSETS**
}
**SIGN**
buildTypes
{
debug
{
minifyEnabled **MINIFY_DEBUG**
useProguard **PROGUARD_DEBUG**
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-unity.txt'**USER_PROGUARD**
jniDebuggable true
}
release
{
minifyEnabled **MINIFY_RELEASE**
useProguard **PROGUARD_RELEASE**
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-unity.txt'**USER_PROGUARD**
**SIGNCONFIG**
}
}
}
If anyone knows how to fix this, please share! I've ready through all of the similar problems here on SO, but none of the supposed solutions work. I keep changing version numbers all over the place, and still, errors.
On top of that, my Unity CloudBuild also fails, with similar problems. I don't have control over what versions they have, so I can't even begin to plan on how to fix that.
Please help!! and thank you sincerely!
-Matt

how to generate app-debug

when I pressed run button I checked apk floder where app-debug-unaligned.apk generated but app-debug.apk not refreshed. I don't know what I did that this happened. check the date in picture
EDIT: maybe people think I am lying but it's not true. maybe problem is in build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.0"
defaultConfig {
applicationId "ir.parsdroid.instagrameducation"
minSdkVersion 8
targetSdkVersion 23
versionCode 11
versionName "1.5.3"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
debug {
minifyEnabled true
proguardFile 'proguard-android-optimize.txt'
zipAlignEnabled false
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:23.0.0'
compile 'com.android.support:support-v4:23.0.0'
compile files('src/main/libs/adad-2.9.jar')
}
In android studio, APK gets generated when we rebuild an application or run an application.
To get debug apk :
Rebuild your project or run your project
check your_app_location\app\build\outputs\apk
Edited :
Here in your gradle file you have used 'zipAlignEnabled' :
debug {
minifyEnabled true
proguardFile 'proguard-android-optimize.txt'
zipAlignEnabled false
}
Problem is because of it. So please check how to use 'zipAlignEnabled' and try again.!!
Hope it will help.
Agree with Mamata Gelanee. You can simply remove app-debug.apk file from folder and clean the project and release new build again then check.

The project is using an unsupported version of the Android Gradle plug-in (0.13.2). The recommended version is 1.0.0-rc2 [duplicate]

I've just updated my Android Studio and now my project won't build anymore. I get following error:
Error:(16, 0) Gradle DSL method not found: 'runProguard()'
Possible causes:<ul><li>The project 'App' may be using a version of Gradle that does not contain the method.
Gradle settings</li><li>The build file may be missing a Gradle plugin.
Apply Gradle plugin</li>
I didn't change anything, everything worked properly before the update. Here's my build.gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "20.0.0"
defaultConfig {
applicationId "com.ochs.pipette"
minSdkVersion 10
targetSdkVersion 21
versionCode 8
versionName "1.6"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:21.0.0'
compile 'it.sephiroth.android.library.imagezoom:library:1.0.4'
compile 'com.android.support:palette-v7:21.0.+'
}
And here's the other one:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0-rc2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
I don't know how to fix the problem, could anyone help me?
runProguard has been renamed minifyEnabled. See the changelog here for confirmation - version 0.14.0 (2014/10/31) of the Android Gradle plugin made the swap.
As #stkent said, runProguard has been renamed to minifyEnabled in version 0.14.0 (2014/10/31) of Gradle.
To fix this, you need to change runProguard to minifyEnabled in the build.gradle file of your project. For example,
buildTypes {
release {
runProguard false // Does not exist anymore...
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
would be replaced by
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
You can see other issues here but this worked for me.
runProguard has been renamed to minifyEnabled in version 0.14.0 (2014/10/31) of Gradle.
To fix this, you need to change runProguard to minifyEnabled in the build.gradle file of your project.

Error:The project is using an unsupported version of the Android Gradle plug-in (0.12.2)

After update Android Studio I cant run my app - I get this Exception:
Error:The project is using an unsupported version of the Android Gradle plug-in (0.12.2). The recommended version is 1.0.0-rc4.
This is my buld.gradle dependencies
dependencies {
classpath 'com.android.tools.build:gradle:0.12.+'
classpath 'com.crashlytics.tools.gradle:crashlytics-gradle:1.+'
}
UPDATE I changed in build.gradle and now I get this error:
Error:(42, 0) Gradle DSL method not found: 'runProguard()'
Possible causes: The project 'drivernotes-android' may be using a version of Gradle that does not contain the method.
Gradle settings The build file may be missing a Gradle plugin.
Apply Gradle plugin
UPDATE 2
This is my build.gradle (fragment):
buildscript {
repositories {
maven { url 'http://repo1.maven.org/maven2' }
maven { url 'http://download.crashlytics.com/maven' }
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0-rc4'
classpath 'com.crashlytics.tools.gradle:crashlytics-gradle:1.+'
}
}
apply plugin: 'android'
apply plugin: 'crashlytics'
repositories {
maven { url 'http://download.crashlytics.com/maven' }
}
android {
compileSdkVersion 19
buildToolsVersion '19.1.0'
defaultConfig {
minSdkVersion 9
targetSdkVersion 19
}
packagingOptions {
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
buildTypes {
release {
minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
signingConfigs {
}
}
Use this version of gradle plugin
classpath 'com.android.tools.build:gradle:1.0.0-rc4'
For more info related to gradle plugin and android studio compatiblity refer this
Edit
As of now both android studio as well as gradle plugin are both stable hence use this
classpath 'com.android.tools.build:gradle:1.0.0'
In App build.gradle in buildTypes{} i think you using runproguard. runProguard is depreceated so use minifyEnabled instead of runproguard
Edited :
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
update answer
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
You have to update your classpath. Currently I've got:
classpath 'com.android.tools.build:gradle:1.0.0-rc4'
Edit:
Replace runProguard with minifyEnabled in your gradle build file
Seems like these answers are very old, here is figured out the way to to fix the problem,
From AndriodStudio,
Step1: Cntrl+Alt+Shift => "S", will open a "Project Structure" window,
-or-
File > Project Structure
Step2: choose "Project" from the left array.
Step3: Change the gradlew version here.

Categories

Resources