I've just updated my project to the Android Gradle plugin 0.9.0 and I'm getting the following error trying to run my project:
FAILURE: Build failed with an exception.
* Where:
Build file 'C:\...\facebookSDK\build.gradle' line: 12
* What went wrong:
A problem occurred evaluating project ':facebookSDK'.
> Could not find method release() for arguments [build_3ug2bdgu6mi6jljp3krac916n3$_run_closure1_closure4#e1bf3ff] on project ':facebookSDK'.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
I only get this error with one of my projects. If I switch back to 0.8.+ it works fine.
This is the gradle.build file of the facebookSDK module.
apply plugin: 'android-library'
android {
compileSdkVersion 19
buildToolsVersion "19.0.3"
defaultConfig {
minSdkVersion 8
targetSdkVersion 8
}
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
lintOptions {
abortOnError false
}
}
dependencies {
compile 'com.android.support:support-v4:+'
}
i'm pretty sure that release { ... } should be inside buildTypes(which should be inside android) not in android
Related
I cloned a working project from git , and starting to run it but this error shown up. However on another laptop it works fine showing no errors. that I thought the problem is my laptop, but trying to run a different projects and they worked successfully
ProcessException: Process "E:\cantina-customer\android\gradlew.bat" exited abnormally:
FAILURE: Build failed with an exception.
* Where:
Build file 'E:\cantina-customer\android\app\build.gradle' line: 24
* What went wrong:
A problem occurred evaluating project ':app'.
> ASCII
* 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 2s
Command: E:\cantina-customer\android\gradlew.bat app:properties
Please review your Gradle project setup in the android/ folder.
and here my build.gradle/appLevel
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
compileSdkVersion 28
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "app.cantina.customer"
minSdkVersion 21
targetSdkVersion 28
multiDexEnabled true
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
}
}
}
flutter {
source '../..'
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
apply plugin: 'com.google.gms.google-services'
I have tried to run a different application and it worked fine without any errors , any idea on How can I solve this in this project specifically?
I upgraded my build.gradle file to android gradle plugin 3.4.0 with gradle 5.11.
My build.gradle:
apply plugin: 'com.android.application'
apply plugin: 'checkstyle'
android {
compileSdkVersion 28
buildToolsVersion buildVersion
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
defaultConfig {
applicationId "myapp"
minSdkVersion 21
targetSdkVersion 28
versionName "5.20.0"
versionCode 520
}
dataBinding {
enabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation "com.android.support:support-v4:$supportLibVersion"
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
implementation fileTree(dir: 'libs', include: ['*.jar'])
}
task checkstyle(type: Checkstyle) {
source 'src/'
include '**/*.java'
exclude '**/gen/**'
classpath = files()
reports {
xml {
destination "build/outputs/reports/checkstyle-results.xml"
}
}
group = JavaBasePlugin.VERIFICATION_GROUP
description = 'Performs checkstyle verification on the code.'
}
task checkstyleReport(dependsOn: 'checkstyle', group: JavaBasePlugin.VERIFICATION_GROUP) {
if (file("build/outputs/reports/checkstyle-results.xml").exists()) {
ant.xslt(in: "build/outputs/reports/checkstyle-results.xml",
style: "./config/checkstyle/checkstyle.xsl",
out: "build/outputs/reports/checkstyle-results.html"
)
}
}
When syncing I get the following error message:
FAILURE: Build failed with an exception.
Where: Build file '/Users/cs/Development/project/app/build.gradle'
What went wrong: A problem occurred evaluating project ':app'.
Could not find method destination() for arguments [build/outputs/reports/checkstyle-results.xml] on Report xml of type
org.gradle.api.reporting.internal.TaskGeneratedSingleFileReport.
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 1s ERROR: Gradle DSL method not found: 'destination()'
Possible causes: The project 'project' may be using
a version of the Android Gradle plug-in that does not contain the
method (e.g. 'testCompile' was added in 1.1.0). Upgrade plugin to
version 3.4.0 and sync project
The project 'project' may be using a version of
Gradle that does not contain the method. Open Gradle wrapper file
The build file may be missing a Gradle plugin. Apply Gradle plugin
The error points to this lines:
reports {
xml {
destination "build/outputs/reports/checkstyle-results.xml"
}
}
Has the syntax for destination been changed in gradle?
Solution
reports {
xml {
destination file("build/outputs/reports/checkstyle-results.xml")
}
}
The method used to take an Object, but now requires a File type as a parameter - hence the parameter error.
So passing in a file instead solves the problem.
You can see the expected parameter types here:
https://docs.gradle.org/current/javadoc/org/gradle/api/reporting/ConfigurableReport.html#setDestination-java.io.File-
I've converted an Eclipse project for AndroidStudio then I got some errors "package does not exits", it package is library module.
library project's gradle scripts as follows.
apply plugin: 'com.android.library'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
minSdkVersion 9
targetSdkVersion 22
versionCode 1
versionName "1.0.0"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard.cfg'
}
debug {
minifyEnabled false
}
}
lintOptions {
abortOnError false
}
useLibrary 'org.apache.http.legacy'
}
dependencies {
compile 'com.android.support:support-v4:22.0.0'
compile 'com.google.android.gms:play-services:9.0.0'
}
and the project's gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "xxxxxxxxxxxxxxxxx"
minSdkVersion 9
targetSdkVersion 22
versionCode 1
versionName "1.0.0"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard.cfg'
}
debug {
minifyEnabled false
}
}
lintOptions {
abortOnError false
}
}
dependencies {
compile 'com.android.support:support-v4:23.0.0'
compile 'com.google.android.gms:play-services:9.0.0'
compile project(':library')
}
It's weird because IDE does not show any errors while coding and can import package properly but when I try to "run" the project, then error occurs.
I would appreciate it if someone could solve this problem.
Edited
Project Structure is like below.
- app (com.sample.apps)
- library (com.sample.library)
Actual Error Messages
package com.sample.library.xxx does not exits // <- My Custom Class. There are hundreds of errors.
Gradle Errors
:app:compileDebugJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
100 errors
:app:compileDebugJavaWithJavac FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 4.344 secs
Solved
I solved this by using product flavors.
This is because library project is going to apply proguard and that's why application project can't find package.
I changed 'com:android:library' to 'com:android:application' and move app project as product flavors.
Everybody, im trying to generate a signed APK file , with android studio, Firts of all, I changed the "Build variant" from debug to release, then on grade.app minifyEnabled i put true, finally I created my Key and my password, and everything is alright until here, but on my last click, Android studio trys to generate the file but this message comes out
Warning: com.google.android.gms.auth.GoogleAuthUtil: can't find referenced method 'void setLatestEventInfo(android.content.Context,java.lang.CharSequence,java.lang.CharSequence,android.app.PendingIntent)' in library class android.app.Notification
Warning: there were 1 unresolved references to library class members.
You probably need to update the library versions.
(http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedlibraryclassmember)
:app:proguardRelease FAILED
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:proguardRelease'.
java.io.IOException: Please correct the above warnings first.
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
im too new with this software , so please be patient with me, i dont know which libraries should i Update.
My compileSdkVersion is 23, and my targed sdk version is 23.
Thanks you all of you.
here is my build.grade file
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.example.manuelrios.aplicacion_inmobiliaria"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.google.android.gms:play-services:4.2.42'
}
Add the below code in your app gradle
android {
compileSdkVersion 29
buildToolsVersion "29.0.3"
.
.
.
lintOptions {
checkReleaseBuilds false
}
}
Recently I have updated the Android Studio and also the SDK.
While rebuilding my app project i m getting following error...
What went wrong:
A problem occurred configuring project ':app'.
Could not resolve all dependencies for configuration ':app:_debugCompile'.
Could not find com.android.support:appcompat-v7:23.0.0.
Searched in the following locations:
https://jcenter.bintray.com/com/android/support/appcompat-v7/23.0.0/appcompat-v7-23.0.0.pom
https://jcenter.bintray.com/com/android/support/appcompat-v7/23.0.0/appcompat-v7-23.0.0.jar
file:/C:/android new SDK/extras/android/m2repository/com/android/support/appcompat-v7/23.0.0/appcompat-v7-23.0.0.pom
file:/C:/android new SDK/extras/android/m2repository/com/android/support/appcompat-v7/23.0.0/appcompat-v7-23.0.0.jar
file:/C:/android new SDK/extras/google/m2repository/com/android/support/appcompat-v7/23.0.0/appcompat-v7-23.0.0.pom
file:/C:/android new SDK/extras/google/m2repository/com/android/support/appcompat-v7/23.0.0/appcompat-v7-23.0.0.jar
Required by:
AppOne:app:unspecified
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 4.913 secs
...............................................................
My Gradle file config is as follows ..
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.0"
defaultConfig {
applicationId "com.example.myapplication"
minSdkVersion 9
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.0.0'
}
Take android sdk manager and update
Android support Library
Android support Repository
It will fix the problem.
You need to install/Update the Android support Library and Android support Repository first and then rebuild the project.