I have problem with Gradle building for Android. I tried a lot of methods for resolve this problem but nothing is not working. I need help.
Gradle version: 4.4
Gradle plugin: 3.0.1
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
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'
}
}
buildToolsVersion '26.0.2'
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
flavorDimensions "group1"
productFlavors {
server {
versionName '0.1'
minSdkVersion 21
targetSdkVersion 26
testInstrumentationRunner 'android.support.test.runner.AndroidJUnitRunner'
versionCode 1
dimension "group1"
}
mock {
minSdkVersion 21
targetSdkVersion 26
testInstrumentationRunner 'android.support.test.runner.AndroidJUnitRunner'
versionCode 1
versionName '0.1'
dimension "group1"
}
}
configurations.all {
resolutionStrategy.force 'com.google.code.findbugs:jsr305:1.3.9'
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
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.arello-mobile:moxy:1.5.3'
annotationProcessor 'com.arello-mobile:moxy-compiler:1.5.3'
implementation 'com.squareup.retrofit2:retrofit:2.3.0'
implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
implementation 'com.squareup.okhttp3:logging-interceptor:3.8.0'
implementation 'com.google.code.gson:gson:2.8.2'
annotationProcessor 'com.google.dagger:dagger-compiler:2.13'
implementation 'com.google.dagger:dagger:2.13'
implementation 'com.google.guava:guava:23.5-android'
implementation 'com.vk:androidsdk:1.6.9'
implementation project(':vksdk_library')
}
Error:Unable to resolve dependency for ':app#serverDebug/compileClasspath': Could not resolve project :vksdk_library.
Error:Unable to resolve dependency for ':app#mockDebugAndroidTest/compileClasspath': Could not resolve project :vksdk_library.
Error:Unable to resolve dependency for ':app#mockDebugUnitTest/compileClasspath': Could not resolve project :vksdk_library.
Error:Unable to resolve dependency for ':app#serverRelease/compileClasspath': Could not resolve project :vksdk_library.
As from docs, gradle dependency section You can use
implementation 'com.vk:androidsdk:1.6.9'
instead of adding the whole project yourself
Note: you also must have maven support added in your project
As mentioned here in docs rest leave it gradle to download and link library
Related
While creating android library in project & creating new project in android studio 3.5.1 , I got the error as Unable to find valid certification path to requested target.
I have tried lots of solutions available on stack overflow eg.,set proxy but didn't worked for me.
I exactly didn't get the solution for this error.
If anyone has solution for this error please share.
My build.gradle looks like:
apply plugin: 'com.android.application'
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "com.example.poc1"
minSdkVersion 21
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.0.0-beta01'
implementation 'androidx.constraintlayout:constraintlayout:1.1.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.0-alpha4'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-alpha4'
implementation 'com.android.volley:volley:1.1.0'
implementation 'com.squareup.retrofit2:retrofit:2.3.0'
implementation 'com.squareup.retrofit2:converter-gson:2.2.0'
}
earlier was working fine but the time i updated the versions of libraries it went wrong
here is the app.gradle file, also tested with compile version 27 and 28 as well
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.example.test"
minSdkVersion 19
targetSdkVersion 26
multiDexEnabled true
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
packagingOptions {
exclude 'META-INF/proguard/androidx-annotations.pro'
}
}
after changing dependendencies to androidX version , issue is there
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0-alpha02'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha3'
implementation 'com.google.android.material:material:1.1.0-alpha04'
implementation 'androidx.recyclerview:recyclerview:1.1.0-alpha03'
implementation 'com.lsjwzh:materialloadingprogressbar:0.5.8-RELEASE'
implementation 'com.jakewharton:butterknife:10.1.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:10.1.0'
testImplementation 'junit:junit:4.12'
implementation 'com.android.support:multidex:1.0.1'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
in build.gradle file
classpath 'com.android.tools.build:gradle:3.1.2'
I'm changing the minSdk version but when I build/generate apk(s) I get this error:
failed linking references.
I have tried Invalidating Caches and restarting
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.clubs"
minSdkVersion 21
targetSdkVersion 27
vectorDrawables.useSupportLibrary = true
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
productFlavors {
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'androidx.appcompat:appcompat:1.1.0-alpha02'
implementation 'com.google.android.material:material:1.1.0-alpha04'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.android.gms:play-services-maps:16.1.0'
implementation 'com.jakewharton:butterknife:8.8.1'
implementation 'nl.psdcompany:duo-navigation-drawer:3.0.0'
implementation 'com.github.ApendIr:slider:1.0'
implementation 'com.azoft.carousellayoutmanager:carousel:1.2.4'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.2-alpha01'
implementation 'com.jakewharton:butterknife:10.1.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:10.1.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.2-alpha01'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
}
I don't know if this is what is resulting to the apps crashing in some phones
Set the min SDK version within your project's AndroidManifest.xml file:
<uses-sdk android:minSdkVersion="21"/>
I have updated my apps build tools to 28.0.0. The application fails to install to device due to the following error:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:transformClassesWithDexBuilderForDebug'
If I remove Lombok dependecies then everything runs without any issues.
I can't seem to figure what is the problem and am not able to find info about this online. Any thoughts?
My app gradle config:'
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "my.package.budgeter"
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
buildToolsVersion '28.0.2'
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
compileOnly 'org.projectlombok:lombok:1.18.2'
annotationProcessor 'org.projectlombok:lombok:1.18.2'
}
Found out that there is an issue with 1.18.2 version.
Rolled back to version 1.16.20. This fixed the issue.
I have install android studio on macbook pro and I am sure I have install all the required SDK for it to work but yet still I am having issues with errors. below is the error messages
Unable to resolve dependency for ':app#debug/compileClasspath': Could not resolve com.android.support:appcompat-v7:26.0.0-beta1.
Could not resolve com.android.support:appcompat-v7:26.0.0-beta1.
Required by: project :app
No cached version of com.android.support:appcompat-v7:26.0.0-beta1 available for offline mode.
here is my gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.example.air.my1st"
minSdkVersion 15
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.0.0-beta1'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:design:26.0.0-beta1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:0.5'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:2.2.2'
}
Thanks all in advance.
add this code in build.gradle:
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
Try to change the targetSdkVersion 27
Dependencies to latest:
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'