Error:Configuration with name 'default' not found. Google did not know - java

Hello I have a problem with thise error
Error:Configuration with name 'default' not found.
my build.gradle :projeck
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
my build.gradle :app
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "24.0.3"
defaultConfig {
applicationId "com.atry.paradox.listdrop"
minSdkVersion 15
targetSdkVersion 24
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(':library2')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:24.2.1'
testCompile 'junit:junit:4.12'
}
my settings.gradle
include ':app', ':library2'
I looking for thise error on google, but I found advice for copy library2 to main file. I have library 2 on the same file where I have app, build, gradle ...
Please where I Do error?
Thanks

It depends by the settings.gradle file:
include ':app', ':library2'
Gradle is looking for 2 projects (app and library2).
Each of these projects must have the build.gradle file inside.
root
|--build.gradle
|--settings.gradle
|--app
|----build.gradle
|--library2
|----build.gradle
This error:
Error:Configuration with name 'default' not found.
happens if a module (or more) doens't have the build.gradle file.
Check if your library2 folder has the build.gradle and the right structure.

Related

How to resolve duplicate class error in gradle build?

I have tried to use ibm tone analyzer api for my project, but if I include the dependency I get this error:
Duplicate class javax.annotation.CheckForNull found in modules
annotations-3.0.1.jar (com.google.code.findbugs:annotations:3.0.1) and
jsr305-3.0.2.jar (com.google.code.findbugs:jsr305:3.0.2) Duplicate
class javax.annotation.CheckForSigned found in modules
annotations-3.0.1.jar (com.google.code.findbugs:annotations:3.0.1) and
jsr305-3.0.2.jar (com.google.code.findbugs:jsr305:3.0.2)
I have tried to delete testing dependencies, but still won't work, please help
App File:
apply plugin: 'com.android.application'
android {
configurations.all{
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
}
compileSdkVersion 28
defaultConfig {
applicationId "com.example.loginapp"
minSdkVersion 22
targetSdkVersion 28
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
compile 'com.ibm.watson:tone-analyzer:7.0.0'
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
exclude module: 'jsr305:3.0.2'
})
implementation 'com.google.firebase:firebase-auth:16.2.1'
}
// Add the following line to the bottom of the file:
apply plugin: 'com.google.gms.google-services' // Google Play services Gradle plugin
Gradle Build file:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.0'
classpath 'com.google.gms:google-services:4.2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
maven {
url "https://dl.bintray.com/ibm-cloud-sdks/ibm-cloud-sdk-repo"
}
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
add applicationVariants.all to your gradle.build:
android {
applicationVariants.all { variant ->
variant.getRuntimeConfiguration().exclude group: 'com.google.code.findbugs', module: 'jsr305'
}
}

FireBase Sync with Android Studio failed

I try implementing an app that put details about you in database in Firebase.
I do the sync with the code from the website from Firebase
Android Studio Version: 3.0.1
The Code is from THIS
build.gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
//you need to add this line
classpath 'com.google.gms:google-services:3.2.0' // google-services plugin
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com" // Google's Maven repository
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
build.gradle in the app:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.example.eranp.clientpage"
minSdkVersion 19
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
implementation files('libs/activation.jar')
implementation files('libs/additionnal.jar')
implementation files('libs/mail.jar')
compile 'com.google.firebase:firebase-auth:11.8.0'
}
apply plugin: 'com.google.gms.google-services'
The error output:
Error:Could not find com.google.gms:google-services:3.2.0. Searched
in the following locations:
file:/C:/Program Files/Android/Android Studio/gradle/m2repository/com/google/gms/google-services/3.2.0/google-services-3.2.0.pom
file:/C:/Program Files/Android/Android Studio/gradle/m2repository/com/google/gms/google-services/3.2.0/google-services-3.2.0.jar
Required by:
project :
What do I need to do to fix that?

Adding Kotlin to existing Java project breaks Android Studio gradle messages errors

I am very new to Gradle and Android but since I have added Kotlin to my project anytime I get an error in Android Studio I need to go through the Gradle console which does not give me any of the nice stack traces or pathing by default. In the Gradle messages view where errors did appear now I only get
Error:Execution failed for task ':app:kaptDebugKotlin'.
Internal compiler error. See log for more details
Is this the intended functionality because it seems to work ok in the jetbrains example projects.
My Project Gradle file
buildscript {
ext.kotlin_version = '1.1.4-2'
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
My App level Gradle file
buildscript {
ext.kotlin_version = '1.1.4-2'
repositories {
jcenter()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.kotlin:kotlin-android-extensions:$kotlin_version"
}
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.test.andrew.ccombo_breaker"
minSdkVersion 19
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
sourceSets {
main.java.srcDirs += 'src/main/java'
main.java.srcDirs += 'src/main/kotlin'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
compile 'com.google.dagger:dagger:2.9'
kapt 'com.google.dagger:dagger-compiler:2.9'
testCompile 'junit:junit:4.12'
}
I did not see any problems,May be you can see here [Gradle Console] ,it print all bulid log.you can see error details,and post error message.
That is old config,May be you can config new like this:
1.remove all about Kotlin config.
2.use the menu->tools-->Kotlin-->Configure Kotlin in project-->Android with Gradle
3.change version to 1.1.2-2, the version 1.1.4-2 for gradle:2.3.3 has something bug
4.Sync gradle
other. The new version use extensions only config this:
apply plugin: 'kotlin-android-extensions'
dont use this:
dependencies {
classpath "org.jetbrains.kotlin:kotlin-android-extensions:$kotlin_version"
}
ultimate,config like this
Project Gradle file
buildscript {
ext.kotlin_version = '1.1.2-2'
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
App level Gradle file
apply plugin: 'kotlin-kapt'
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.test.andrew.ccombo_breaker"
minSdkVersion 19
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
kapt {
generateStubs = true
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
compile 'com.google.dagger:dagger:2.9'
kapt 'com.google.dagger:dagger-compiler:2.9'
testCompile 'junit:junit:4.12'
}
Kotlin official doc

plugin with id 'com.android.application' not found. android studio jni sample

I am trying to follow the android-studio-jni tutorial from the following link:
https://codelabs.developers.google.com/codelabs/android-studio-jni/index.html?index=..%2F..%2Findex#2
The simple android app works fine but as soon as I change the classpath to the gradle-experimental as suggested in the tutorial, i get the above mentioned error. I did look at other SO questions related to this but none of them solved my issue.
These are the only changes I made(as done in the tutorial example):
In build.gradle (Module:app) file:
`proguardFiles getDefaultProguardFile('proguard-android.txt'),` `'proguard-rules.pro'`
replaced with :
proguardFiles.add(file('proguard-android.txt'))
In Gradle-wrapper.properties (Gradle Version):
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
replaced with
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
In build.gradle (Project:Samples) file:
classpath 'com.android.tools.build:gradle:2.3.3'
replaced with
classpath 'com.android.tools.build:gradle-experimental:0.9.3’

Update:
As suggested by #Hetfieldan24 , my mistake was not having the correct plugin type.
Once I modified it, I am now getting the following error:
Error:(3, 0) Could not find method android() for arguments [build_90xijo5xugofjl1c4u81bbnlj$_run_closure1#e9e4277] on project ':app' of type org.gradle.api.Project.
Files:
build.gradle (Module:app)
apply plugin: 'com.android.model.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.0"
defaultConfig {
applicationId "com.polyyai.user.samplejniapp1"
minSdkVersion 25
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
//proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
proguardFiles.add(file('proguard-android.txt'))
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:26.+'
compile 'com.android.support.constraint:constraint-layout:1.0.1'
compile 'com.android.support:design:26.+'
testCompile 'junit:junit:4.12'
}
build.gradle (Project:Samples)
// 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:2.3.3'
classpath 'com.android.tools.build:gradle-experimental:0.9.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Gradle-wrapper.properties (Gradle Version)
#Sat Aug 19 17:05:08 EDT 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
Any help is appreciated.
Thanks

I have imported a project in android studio and have a "could not find android method" error

Here's the build.gradle file
// 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:2.2.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
android {
buildToolsVersion '23.0.0'
}
dependencies {
}
Here is the app build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.example.currentplacedetailsonmap"
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
resValue "string", "google_maps_key", (project.findProperty("GOOGLE_MAPS_API_KEY") ?: "")
}
buildTypes {
debug {
debuggable true
}
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.1.1'
compile 'com.google.android.gms:play-services:10.0.1'
testCompile 'junit:junit:4.12'
}
The error is
Error:(22, 0) Could not find method android() for arguments [build_4zgce4e0vr1il6017s3d6qypf$_run_closure3#4c674a56] on root project 'CurrentPlaceDetailsOnMap' of type org.gradle.api.Project.
Open File
How do I change this ,I have tried changing the build version too but it is not helping

Categories