this is my build.gradle file:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.14.2'
}
}
apply plugin: 'com.android.application'
repositories {
jcenter()
}
android {
compileSdkVersion 19
buildToolsVersion "19.1.0"
defaultConfig {
applicationId "com.example.stopcall.app"
minSdkVersion 14
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:support-v4:21.0.3'
compile 'org.roboguice:roboguice:3.+'
provided 'org.roboguice:roboblender:3.+'
}
I don't know why but sometimes I get this error while building:
Error:Gradle: A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugCompile'.
> Could not resolve org.roboguice:roboguice:3.+.
Required by:
StopCall:app:unspecified
> Failed to list versions for org.roboguice:roboguice.
> Unable to load Maven meta-data from https://jcenter.bintray.com/org/roboguice/roboguice/maven-metadata.xml.
> Could not GET 'https://jcenter.bintray.com/org/roboguice/roboguice/maven-metadata.xml'.
> cache.corp.google.com: nodename nor servname provided, or not known
> Failed to list versions for org.roboguice:roboguice.
> Unable to load Maven meta-data from https://jcenter.bintray.com/org/roboguice/roboguice/maven-metadata.xml.
> Could not GET 'https://jcenter.bintray.com/org/roboguice/roboguice/maven-metadata.xml'.
> cache.corp.google.com
> Could not resolve org.roboguice:roboblender:3.+.
Required by:
StopCall:app:unspecified
> Failed to list versions for org.roboguice:roboblender.
> Unable to load Maven meta-data from https://jcenter.bintray.com/org/roboguice/roboblender/maven-metadata.xml.
> Could not GET 'https://jcenter.bintray.com/org/roboguice/roboblender/maven-metadata.xml'.
> cache.corp.google.com
> Failed to list versions for org.roboguice:roboblender.
> Unable to load Maven meta-data from https://jcenter.bintray.com/org/roboguice/roboblender/maven-metadata.xml.
> Could not GET 'https://jcenter.bintray.com/org/roboguice/roboblender/maven-metadata.xml'.
> cache.corp.google.com
what can it be? as it can happen in a specific hour and few hours later (maybe another network) it might be fixed.
any idea?
Are you behind a proxy?
if so check your gradle properties file
Under C:\Users\.gradle\ create a gradle.properties file with the proxy details:
systemProp.http.proxyHost=hostname
systemProp.http.proxyPort=8080
systemProp.http.proxyUser=username
systemProp.http.proxyPassword=xxx
systemProp.https.proxyHost=hostname
systemProp.https.proxyPort=8080
systemProp.https.proxyUser=username
systemProp.https.proxyPassword=password
systemProp.https.nonProxyHosts=localhost
Related
When I try add mongodb-driver implementation to dependencies block at build.gradle I get this build error. I try downgrade and enable to enableDexEnable for solve this problem but problem is continue. I search almost internet but can not have a solution
> Task :app:mergeExtDexDebug
AGPBI: {"kind":"error","text":"Invalid build configuration. Attempt to create a global synthetic for 'Record desugaring' without a global-synthetics consumer.","sources":[{}],"tool":"D8"}
Invalid build configuration. Attempt to create a global synthetic for 'Record desugaring' without a global-synthetics consumer.
> Task :app:mergeExtDexDebug FAILED
Execution failed for task ':app:mergeExtDexDebug'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
> Failed to transform bson-record-codec-4.8.1.jar (org.mongodb:bson-record-codec:4.8.1) to match attributes {artifactType=android-dex, asm-transformed-variant=NONE, dexing-enable-desugaring=true, dexing-enable-jacoco-instrumentation=false, dexing-is-debuggable=true, dexing-min-sdk=24, org.gradle.category=library, org.gradle.libraryelements=jar, org.gradle.status=release, org.gradle.usage=java-runtime}.
> Execution failed for DexingNoClasspathTransform: C:\Users\user\.gradle\caches\modules-2\files-2.1\org.mongodb\bson-record-codec\4.8.1\339c92291f24acf896334ba9a2a5bf52fd462115\bson-record-codec-4.8.1.jar.
> Error while dexing.
* Try:
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
build.gradle page;
plugins {
id 'com.android.application'
}
android {
namespace 'com.example.appname'
compileSdk 33
defaultConfig {
applicationId "com.example.appname"
minSdk 21
multiDexEnabled true
targetSdk 33
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_11
targetCompatibility JavaVersion.VERSION_11
}
buildToolsVersion '33.0.1'
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.6.0'
implementation 'com.google.android.material:material:1.7.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'org.mongodb:mongodb-driver-sync:4.8.2' //<-mongodb here
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
}
Recently i have updated android studio to 3.1.3 everytime i am getting the "Unable to resolve Ddependency" error. Stuck with this problem already i have wasted lotts of days solving this error but nothing works. Please help me to resolve this error.I have uploaded my gradle file here and also the error log.
Below is my gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.example.administrator.myapplication1"
minSdkVersion 15
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
`}`
`repositories {`
`maven {`
url "https://jitpack.io"
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:27.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'com.android.support:design:27.1.0'
implementation 'de.hdodenhof:circleimageview:2.2.0'
implementation('com.github.ozodrukh:CircularReveal:2.0.1#aar') {
transitive = true;
}
implementation project(':library')
api 'com.github.ozodrukh:CircularReveal:1.1.1'
implementation 'com.squareup.okhttp3:okhttp:3.11.0'
}
allprojects {
repositories {
jcenter()
}
}
apply plugin: 'com.google.gms.google-services'
`
Error log:
Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
Unable to resolve dependency for ':app#debug/compileClasspath': Could not download okhttp.jar (com.squareup.okhttp3:okhttp:3.11.0): Skipped due to earlier error
Open File
Show Details
Unable to resolve dependency for ':app#debugAndroidTest/compileClasspath': Could not download okhttp.jar (com.squareup.okhttp3:okhttp:3.11.0): Skipped due to earlier error
Open File
Show Details
Unable to resolve dependency for ':app#debugUnitTest/compileClasspath': Could not download okhttp.jar (com.squareup.okhttp3:okhttp:3.11.0): Skipped due to earlier error
Open File
Show Details
Unable to resolve dependency for ':app#release/compileClasspath': Could not download okhttp.jar (com.squareup.okhttp3:okhttp:3.11.0): Skipped due to earlier error
Open File
Show Details
Unable to resolve dependency for ':app#releaseUnitTest/compileClasspath': Could not download okhttp.jar (com.squareup.okhttp3:okhttp:3.11.0): Skipped due to earlier error
Open File
Show Details
`
Project(build.gradle):
// 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.1.3'
classpath 'com.google.gms:google-services:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
allprojects {
repositories {
maven {
url "http://dl.bintray.com/florent37/maven"
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
maven {
url "https://jitpack.io"
}
Please add this line in your project level gradle file under repositories. because the library circularReveal is using repo from jitpack. Also remove circular Reveal and rebuild the project, it should be able to build properly.
Project Level Gradle
buildscript {
repositories {
google()
jcenter()
maven {
url "https://jitpack.io"
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
App Level Gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.yourcomp.stackoverflow"
minSdkVersion 16
targetSdkVersion 27
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:appcompat-v7:27.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'com.android.support:design:27.1.0'
implementation 'de.hdodenhof:circleimageview:2.2.0'
implementation 'com.squareup.okhttp3:okhttp:3.11.0'
}
You Just need to update your SDK tools according to the library, and it will work.
I have just downloaded latest Android Studio 3.0 Preview Canary 2. It has updated my project with latest gradle com.android.tools.build:gradle:3.0.0-alpha2. And now I have a lot of compile crashes like:
ERROR: C:\Users\??????\\.gradle\caches\transforms-1\files-1.1\appcompat-v7-25.3.1.aar\a33e01f0d19405567201ecab1e032796\res\drawable-xhdpi-v4\notification_bg_low_normal.9.png not a valid resource file
ERROR: C:\Users\??????\\.gradle\caches\transforms-1\files-1.1\appcompat-v7-25.3.1.aar\a33e01f0d19405567201ecab1e032796\res\drawable-xhdpi-v4\notification_bg_low_normal.9.png not a valid resource file
ERROR: C:\Users\??????\\.gradle\caches\transforms-1\files-1.1\design-25.3.1.aar\ab2edc05ef7bbad4b3861a867a381098\res\drawable-xxxhdpi-v4\design_ic_visibility.png not a valid resource file
ERROR: C:\Users\??????\\.gradle\caches\transforms-1\files-1.1\design-25.3.1.aar\ab2edc05ef7bbad4b3861a867a381098\res\drawable-xxxhdpi-v4\design_ic_visibility.png not a valid resource file
ERROR: C:\Users\??????\\.gradle\caches\transforms-1\files-1.1\appcompat-v7-25.3.1.aar\a33e01f0d19405567201ecab1e032796\res\drawable-mdpi-v4\abc_menu_hardkey_panel_mtrl_mult.9.png not a valid resource file
ERROR: C:\Users\??????\\.gradle\caches\transforms-1\files-1.1\appcompat-v7-25.3.1.aar\a33e01f0d19405567201ecab1e032796\res\drawable-mdpi-v4\abc_menu_hardkey_panel_mtrl_mult.9.png not a valid resource file
ERROR: C:\Users\??????\\.gradle\caches\transforms-1\files-1.1\appcompat-v7-25.3.1.aar\a33e01f0d19405567201ecab1e032796\res\drawable-xxxhdpi-v4\abc_spinner_mtrl_am_alpha.9.png not a valid resource file
ERROR: C:\Users\??????\\.gradle\caches\transforms-1\files-1.1\appcompat-v7-25.3.1.aar\a33e01f0d19405567201ecab1e032796\res\drawable-xxxhdpi-v4\abc_spinner_mtrl_am_alpha.9.png not a valid resource file
ERROR: C:\Users\??????\\.gradle\caches\transforms-1\files-1.1\appcompat-v7-25.3.1.aar\a33e01f0d19405567201ecab1e032796\res\drawable-mdpi-v4\abc_btn_check_to_on_mtrl_000.png not a valid resource file
FAILURE: Build failed with an exception.
* What went wrong: Execution failed for task ':app:mergeDebugResources'.
> Error: java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.internal.aapt.AaptException: AAPT2 compile failed: aapt2 compile -o D:\AndroidProjects\GetPet\app\build\intermediates\res\merged\debug C:\Users\user\\.gradle\caches\transforms-1\files-1.1\design-25.3.1.aar\ab2edc05ef7bbad4b3861a867a381098\res\layout\design_navigation_item.xml Issues:
- ERROR: C:\Users\user\\.gradle\caches\transforms-1\files-1.1\design-25.3.1.aar\ab2edc05ef7bbad4b3861a867a381098\res\layout\design_navigation_item.xml not a valid resource file
I have tried to clean project and gradle cache, but useless.
My build.gradle
buildscript {
repositories {
jcenter()
maven {
url 'https://maven.google.com'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0-alpha2'
// 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
}
And app\build.gradle
apply plugin: 'com.android.application'
android {
signingConfigs {
config {
keyAlias 'alias'
keyPassword 'pass'
storeFile file('release_keystor.jks')
storePassword 'pass'
}
}
compileSdkVersion 25
buildToolsVersion '25.0.2'
defaultConfig {
applicationId "com.org.app"
minSdkVersion 21
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
signingConfig signingConfigs.config
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.config
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:25.3.1'
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
testCompile 'junit:junit:4.12'
compile 'com.android.support:design:25.3.1'
compile 'com.android.volley:volley:1.0.0'
compile 'com.android.support:cardview-v7:25.3.1'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.vk:androidsdk:1.6.5'
}
Try to change service directory path to something without cyrillic symbols, like "C:/gradle" in
Settings > Build, Execution, Deployment > Gradle
And don't forget to invalidate caches.
it gives me this error
"Error:Execution failed for task ':app:processDebugGoogleServices'.
Please fix the version conflict either by updating the version of the google-services plugin (information about the latest version is available at https://bintray.com/android/android-tools/com.google.gms.google-services/) or updating the version of com.google.android.gms to 8.3.0."
Here is my build.gradle (app)
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.uti.magic"
manifestPlaceholders = [onesignal_app_id: "xxxxxxxxxxxxxxxxxxxxxxxxxxx",
// Project number pulled from dashboard, local value is ignored.
onesignal_google_project_number: "REMOTE"]
minSdkVersion 21
targetSdkVersion 22
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:22.2.1'
compile 'com.google.android.gms:play-services-ads:8.3.0'
compile files ('libs/aspectjrt-1.7.3.jar')
compile files ('libs/isoparser-1.0-RC-27.jar')
}
buildscript {
dependencies {
// Add this line
classpath 'com.google.gms:google-services:2.1.2'
}
}
// Add to the bottom of the file
dependencies {
compile 'com.onesignal:OneSignal:3.+#aar'
// Required for OneSignal, even if you have added FCM.
compile 'com.google.android.gms:play-services-gcm:+'
// Required for geotagging
compile "com.google.android.gms:play-services-location:+"
// play-services-analytics is only needed when using 8.1.0 or older.
// compile 'com.google.android.gms:play-services-analytics:+'
}
apply plugin: 'com.google.gms.google-services'
Remove apply plugin: 'com.google.gms.google-services' at the top of build.gradle of app module.
Does anyone know how to fix this?
I tried building my app, but I got an error that it was out of sync or something along those lines, so I searched for the error.
Found a solution that said I had to delete one of the .gradle files, so I did and then this error occurred when trying to build the app again.
I am new to android and java development and have no idea how to fix this.
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugAndroidTestApkCopy'.
> Could not find com.squareup:javawriter:2.1.1.
Required by:
JustJava:app:unspecified > com.android.support.test.espresso:espresso-core:2.2.2
> Could not find javax.inject:javax.inject:1.
Required by:
JustJava:app:unspecified > com.android.support.test.espresso:espresso-core:2.2.2
> Could not find org.hamcrest:hamcrest-library:1.3.
Required by:
JustJava:app:unspecified > com.android.support.test.espresso:espresso-core:2.2.2
> Could not find org.hamcrest:hamcrest-integration:1.3.
Required by:
JustJava:app:unspecified > com.android.support.test.espresso:espresso-core:2.2.2
> Could not find com.google.code.findbugs:jsr305:2.0.1.
Required by:
JustJava:app:unspecified > com.android.support.test.espresso:espresso-core:2.2.2
> Could not find javax.annotation:javax.annotation-api:1.2.
Required by:
JustJava:app:unspecified > com.android.support.test.espresso:espresso-core:2.2.2
> Could not find junit:junit:4.12.
Required by:
JustJava:app:unspecified > com.android.support.test.espresso:espresso-core:2.2.2 > com.android.support.test:runner:0.5
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
This is the build.gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.example.android.justjava"
minSdkVersion 15
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'
}
}
}
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
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.0'
}