i had a android studio project and it was wroks. I had push it to gitlab and after remove it , i had pull it again.
now i get this error when i want to build my gradle:
Error:The module 'app' is an Android project without build variants, and cannot be built.Please fix the module's configuration in the build.gradle file and sync the project again.
it's my build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.0"
defaultConfig {
applicationId "sample.spart.com"
minSdkVersion 21
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(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:support-v4:26.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
implementation 'com.android.support:cardview-v7:27.0.2'
implementation 'com.android.support:design:27.0.2'
implementation 'com.nineoldandroids:library:2.4.0'
implementation 'com.android.support:recyclerview-v7:26.0.0-alpha1'
}
what is the problem and how i can fix it??
Maybe you can try invalidating your cash.
in Android Studio:
File -> Invalidate Caches / Restart
Sharing your project's build.gradle file may help.
Related
I have the following error in Android Studio, and i really do not know what i am doing wrong:
I tried to make a clean project, but it did not resolve the problem.
here you have my gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.cityguidetour"
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
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:design:28.0.0'
implementation 'com.jakewharton:butterknife:10.1.0'
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'
implementation fileTree(dir: 'libs', include: ['*.jar'])
}
Any help please ?
At the end I had to delete the project and create a new one in Android Studio to overcome this problem.
Once Try
Build-> Clean Project
Build -> Rebuild project
Build -> Clean Project
and restart android studio with File -> invalidate cache /Restart
In my gradle, I have a conflict in versions that gives me the error Cannot resolve symbol 'R' but I don't know what is the wrong version.
In my gradle, I have a conflict in versions that gives me the error Cannot resolve symbol 'R' but I don't know what is the wrong version.
Already tried every other solution:
Clean and Rebuild project
Sync project
Clean cache
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.example.ves.gennaio3"
minSdkVersion 14
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(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:cardview-v7:26.1.0'
implementation 'com.android.support:design:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:support-v4:26.1.0'
implementation 'com.android.support:recyclerview-v7:26.1.0'
implementation 'com.google.firebase:firebase-auth:16.0.4'
implementation 'com.google.firebase:firebase-database:16.0.3'
implementation 'com.google.firebase:firebase-ml-vision:17.0.1'
implementation 'com.google.firebase:firebase-firestore:17.1.1'
compile 'com.github.satyan:sugar:1.5'
compile 'com.rmtheis:tess-two:6.0.0'
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'
You cloud try the following:
File -> Invalidate Caches / Restart Android Studio -> Invalidate and Restart
Android Studio maintains information about which files are dependent on which other files. This means you not only have to Gradle sync your files, but you also need to invalidate studio caches.
If I try to sync my app in Android Studio I get the follwing error message:
Failed to resolve: com
Show in File
If I click on "Show in File" my build.gradle opens and my cursor is on the first line.
This is my build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "de.vertretungsplan"
minSdkVersion 14
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:gridlayout-v7:26.1.0'
implementation 'com.android.support:design:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
implementation 'com.android.support:support-v4:26.1.0'
implementation 'com.android.support:support-vector-drawable:26.1.0'
implementation 'com.android.support:cardview-v7:26.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.a ndroid.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
compileOnly 'org.projectlombok:lombok:1.16.20'
annotationProcessor 'org.projectlombok:lombok:1.16.20'
implementation 'com.itextpdf:itextpdf:5.5.13'
implementation 'com.turki-alkhateeb:materialcolorpicker:1.0.7'
}
I hope somebody can help me.
Thanks you very much!
Remove the added space in this line:
androidTestImplementation 'com.a ndroid.support.test:runner:1.0.2'
I created a new project as usual andafter the gradle running I get this error:
`Error:Execution failed for task ':app:preDebugAndroidTestBuild'.
Conflict with dependency 'com.android.support:support-annotations' in project ':app'. Resolved versions for app (26.1.0) and test app (27.1.1) differ. See https://d.android.com/r/tools/test-apk-dependency-conflicts.html for details.`
This is my fresh project gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.example.elili.deltacalculator"
minSdkVersion 18
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(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
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'
I have zero ideas on how to fix it...
If you are not going to implement testing code, then remove junit from your app. You can replace your gradle by below.
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.example.elili.deltacalculator"
minSdkVersion 18
targetSdkVersion 26
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
You need to try the annotation library using:
androidTestCompile 'com.android.support:support-annotations:26.1.0'
First way, It use like this:
Force to use support annotations in the test app, so it is internally used by the runner module.
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:support-v4:26.1.0'
compile 'com.android.support:appcompat-v7:26.1.0'
.
.
.
.
androidTestCompile 'com.android.support:support-annotations:26.1.0'
}
Second way is to use this as:
configurations.all {
resolutionStrategy.force 'com.android.support:support-annotations:26.1.0'
}
I am facing an issue with android studio 3.0.1, when I try to build the gradle project I have this message "Could not find method implementationSDKVersion()"
my gradle version is 4.1 and android plugin version is 3.0.1
here is my complete build.gradle file
apply plugin: 'com.android.application'
android {
implementationSdkVersion 26 //error on this line
defaultConfig {
applicationId "com.anatech.evidencereporter"
minSdkVersion 16
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(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:design:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.google.firebase:firebase-core:11.4.2'
implementation 'com.google.firebase:firebase-database:11.4.2'
implementation 'com.google.firebase:firebase-storage:11.4.2'
implementation 'com.firebaseui:firebase-ui-auth:3.1.0'
implementation 'com.firebaseui:firebase-ui-database:3.1.0'
implementation 'com.google.android.gms:play-services-places:11.4.2'
implementation 'com.github.bumptech.glide:glide:3.7.0'
testImplementation 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
any suggestions?
The problem is in implementationSdkVersion which should be compileSdkVersion. It happens when you are replacing automatically and blindly all the words "compile" with the word "implementation", without a "words" checkbox in the replacement options toolbar, due to gradle update. compile is deprecated for a future use but compileSdkVersion is not. Just had this issue.