I am new to android, when compiling I get this error, it is a bit weird, because until not long ago I did not get it, and I have not made any important change in the project that I remember, and I tried to synchronize gradle, but it gives me 404 error, and I tried to find where this dependency is, because I haven't put any, so I have no idea, I'm quite confused, I thought it was going to be an easy problem to solve, but I can't find a solution, I can't do anything with the 404 error, I am using Avira VPN and Turbo VPN to connect, because without vpn it is impossible in my country, thanks to them I can develop in android, if someone could tell me if I have to add something to the gradle files or remove something I would appreciate it, I am quite stressed about it, android studio errors get over me sometimes This is all it shows me when I sync:
Failed to resolve: customview-1.1.0
Affected Modules: app
This shows me when I try to compile:
note: here is the url that gives me error:
1: Task failed with an exception.
What went wrong:
Execution failed for task ':app:compileDebugKotlin'.
Could not resolve all files for configuration ':app:debugCompileClasspath'.
Could not find customview-1.1.0.jar (androidx.customview:customview:1.1.0).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/androidx/customview/customview/1.1.0/customview-1.1.0.jar
gradle app
plugins {
id 'com.android.application'
id 'kotlin-android'
}
android {
compileSdkVersion 30
buildToolsVersion '30.0.2'
defaultConfig {
applicationId "com.example.navigationrecicler"
minSdkVersion 24
targetSdkVersion 28
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
}
kotlinOptions {
jvmTarget = '1.8'
}
buildFeatures {
viewBinding true
}
}
dependencies {
implementation 'androidx.preference:preference-ktx:1.1.1'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.2.0'
def work_version = "2.6.0"
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.core:core-ktx:1.6.0'
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.0'
implementation 'androidx.drawerlayout:drawerlayout:1.1.1'
implementation 'androidx.coordinatorlayout:coordinatorlayout:1.1.0'
implementation "androidx.work:work-runtime-ktx:$work_version"
implementation "com.anggrayudi:storage:0.12.0"
implementation 'com.github.skydoves:progressview:1.1.2'
implementation 'com.github.bumptech.glide:glide:4.11.0'
implementation 'com.github.mmin18:realtimeblurview:1.2.1'
implementation 'com.yarolegovich:discrete-scrollview:1.5.1'
implementation 'com.github.chrisbanes:PhotoView:2.3.0'
implementation 'com.github.CanHub:Android-Image-Cropper:3.3.5'
annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}
gradle proyect
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = "1.5.10"
repositories {
google()
mavenCentral()
maven { url "https://www.jitpack.io" }
}
dependencies {
classpath "com.android.tools.build:gradle:4.2.2"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.31"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
mavenCentral()
maven { url "https://www.jitpack.io" }
jcenter() // Warning: this repository is going to shut down soon
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
If your problem is with connection , then here is how to solve this
Using your proxy or psiphon , you can set the local proxy port in your setting , lets say 30001
then you can go to %USERNAME%/.gradle/gradle.properties , if the file do not exist then create one.
then you can add this to gradle.properties
systemProp.http.proxyHost=127.0.0.1
systemProp.http.proxyPort=30001
systemProp.https.proxyHost=8.36.224.208
systemProp.https.proxyPort=30001
this will make sure that all connection that gradle use , will go over the turned on proxy .
And after checking the dependencies , you dont have this dependency
runtimeOnly 'androidx.customview:customview:1.1.0'
Related
The error goes on to say "Please fix your configuration (or suppressKotlinVersionCompatibilityCheck but don't say I didn't warn you!)."
It is not obvious to me how to "fix" the configuration. I added the suggested flag, but it does not resolve and fails on its own.
The IDE is Dolphin Android Studio Dolphin | 2021.3.1
The project sets the Kotlin version:
buildscript {
ext.kotlin_version = '1.6.10'
I previously set the project to use Kotlin 1.7.10 here, but downgraded in the vain hope it would solve the issue, but it does not.
I tried adding an explicit dependency on androidx.compose.compiler:compiler which appears to be silently ignored.
I do not see where Kotlin 1.6.21 and Compose Compiler 1.2.0-alpha05 are being set, as neither is set in the build files.
I'm familiar with Android, but not Compose. I am using the current stable IDE and dependency statements taken directly from the Compose documentation, and yet the project fails to build.
I suspect there is some magic combination of dependency versions needed to use Compose in Dolphin, but I have not been able to find it.
I tried Compose at v1.0 but had to back out again as there were so many issues, and it seems it is still challenging to work with, but perhaps some kind soul will point out my error and then I will happily apologise to our friends at Google. :-)
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'androidx.navigation.safeargs'
apply plugin: 'com.google.firebase.crashlytics'
android {
namespace "com.blah"
compileSdk 33
defaultConfig {
applicationId "com.blah"
minSdk 21
targetSdk 33
versionCode 123
versionName "1.2.3"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
flavorDimensions "environment"
productFlavors {
staging {
dimension "environment"
applicationIdSuffix ".staging"
}
production {
dimension "environment"
}
}
applicationVariants.all { variant ->
variant.outputs.all { output ->
outputFileName = "MyApp-${variant.versionName}-${variant.name}.apk"
}
}
sourceSets {
main {
jniLibs.srcDirs = ['libs']
}
}
buildFeatures {
dataBinding true
compose true
}
lint {
disable 'RtlHardcoded'
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
// Coroutines
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.2'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.2'
// Android X Jetpack
implementation "androidx.appcompat:appcompat:1.5.1"
implementation "androidx.lifecycle:lifecycle-extensions:2.2.0"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.1"
implementation 'androidx.core:core-ktx:1.9.0'
implementation "androidx.constraintlayout:constraintlayout:2.1.4"
implementation "androidx.recyclerview:recyclerview:1.2.1"
implementation "androidx.fragment:fragment-ktx:1.5.2"
implementation "androidx.collection:collection-ktx:1.2.0"
implementation "androidx.window:window:1.0.0"
// Jetpack Compose
implementation("androidx.compose.ui:ui:1.2.1")
implementation("androidx.compose.ui:ui-tooling:1.2.1")
// Foundation (Border, Background, Box, Image, Scroll, shapes, animations, etc.)
implementation("androidx.compose.foundation:foundation:1.2.1")
implementation("androidx.compose.material:material:1.2.1")
implementation("androidx.compose.material:material-icons-core:1.2.1")
implementation("androidx.compose.material:material-icons-extended:1.2.1")
// Integration with observables
implementation("androidx.compose.runtime:runtime-livedata:1.2.1")
implementation("androidx.compose.runtime:runtime-rxjava2:1.2.1")
// Google
implementation "com.google.android.material:material:1.6.1"
implementation 'androidx.coordinatorlayout:coordinatorlayout:1.2.0'
// Navigation Component
implementation "androidx.navigation:navigation-fragment-ktx:2.5.2"
implementation "androidx.navigation:navigation-ui-ktx:2.5.2"
// Firebase & Crashlytics
implementation "com.google.firebase:firebase-core:21.1.1"
implementation "com.google.firebase:firebase-analytics:21.1.1"
implementation "com.google.firebase:firebase-crashlytics:18.2.13"
implementation "com.google.firebase:firebase-messaging:21.0.1"
// Urban Airship push messaging
implementation "com.urbanairship.android:urbanairship-fcm:13.3.5"
// Twilio (video calling)
implementation "com.twilio:video-android-ktx:7.1.1"
implementation "com.twilio:audioswitch:1.1.4"
// ExoPlayer
implementation "com.google.android.exoplayer:exoplayer-core:2.18.1"
implementation "com.google.android.exoplayer:exoplayer-ui:2.18.1"
// Third-party
implementation "com.jakewharton.timber:timber:5.0.1"
implementation "com.jakewharton.threetenabp:threetenabp:1.4.0"
implementation "com.squareup.retrofit2:retrofit:2.9.0"
implementation "com.squareup.retrofit2:converter-moshi:2.9.0"
implementation "com.squareup.picasso:picasso:2.71828"
implementation "net.yslibrary.keyboardvisibilityevent:keyboardvisibilityevent:2.3.0"
// https://github.com/square/okhttp/blob/master/CHANGELOG.md
implementation "com.squareup.okhttp3:okhttp:4.9.3"
implementation "com.squareup.okhttp3:logging-interceptor:4.9.3"
// Open Source Licence List
implementation "com.github.franmontiel:AttributionPresenter:1.0.1"
// Shake to Send Feedback
implementation "com.linkedin.shaky:shaky:3.0.4"
implementation "com.jraska:falcon:2.2.0"
// Page Indicator View
implementation 'com.github.romandanylyk:PageIndicatorView:v.1.0.3'
// Testing
implementation "androidx.legacy:legacy-support-v4:1.0.0"
testImplementation "junit:junit:4.13.2"
testImplementation "androidx.test:core:1.4.0"
testImplementation "org.mockito:mockito-core:4.6.0"
androidTestImplementation "androidx.test:runner:1.4.0"
androidTestImplementation "androidx.test.espresso:espresso-core:3.4.0"
androidTestImplementation("androidx.compose.ui:ui-test-junit4:1.2.1")
apply plugin: 'com.google.gms.google-services'
}
Module build file:
apply plugin: "com.github.ben-manes.versions"
buildscript {
ext.kotlin_version = '1.6.10'
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.3.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:2.5.2"
classpath "com.google.firebase:firebase-crashlytics-gradle:2.9.2"
classpath "com.google.gms:google-services:4.3.14"
classpath "com.github.ben-manes:gradle-versions-plugin:0.42.0"
}
}
allprojects {
repositories {
google()
maven { url "https://jitpack.io" }
mavenCentral()
jcenter() {
content {
includeModule("com.google.android", "flexbox")
}
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
In your app/build.gradle file in the android block add:
android {
//..
composeOptions {
kotlinCompilerExtensionVersion "1.3.1"
}
}
According to the compatibility map use kotlin 1.7.10
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:kaptDebugKotlin'.
A failure occurred while executing org.jetbrains.kotlin.gradle.internal.KaptExecution
java.lang.reflect.InvocationTargetException (no error message)
Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:kaptDebugKotlin'.
.......
Caused by: java.lang.NoClassDefFoundError: org/antlr/v4/runtime/CharStreams
....
Caused by: java.lang.ClassNotFoundException: org.antlr.v4.runtime.CharStreams
... 45 more
Build.gradle file (module):
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "org.bloodwyn.userdata"
minSdkVersion 24
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
configurations.all() {
resolutionStrategy.force "org.antlr:antlr4-runtime:4.5.3"
resolutionStrategy.force "org.antlr:antlr4-tool:4.5.3"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
dataBinding {
enabled = true
}
compileOptions {
coreLibraryDesugaringEnabled = true
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8.toString()
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
coreLibraryDesugaring "com.android.tools:desugar_jdk_libs:1.0.9"
//kotlin
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
//android
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.core:core-ktx:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation "androidx.recyclerview:recyclerview:1.1.0"
// For control over item selection of both touch and mouse driven selection
implementation "androidx.recyclerview:recyclerview-selection:1.1.0-rc01"
//retrofit
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
//okhttp
implementation 'com.squareup.okhttp3:okhttp:4.7.2'
implementation 'com.squareup.okhttp3:logging-interceptor:4.7.2'
//rxjava
implementation 'io.reactivex.rxjava3:rxjava:3.0.2'
implementation 'io.reactivex.rxjava3:rxandroid:3.0.0'
implementation "com.github.akarnokd:rxjava3-retrofit-adapter:3.0.0"
//room
def room_version = "2.2.5"
implementation "androidx.room:room-runtime:$room_version"
implementation "androidx.room:room-rxjava2:$room_version"
kapt "androidx.room:room-compiler:$room_version"
//tests
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.ext:truth:1.2.0'
androidTestImplementation 'com.google.truth:truth:1.0'
androidTestImplementation 'androidx.test:core:1.2.0'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test:rules:1.2.0'
debugImplementation 'androidx.fragment:fragment-testing:1.2.5'
//mock http server for tests
testImplementation 'com.squareup.okhttp3:mockwebserver:4.6.0'
//room test
testImplementation "androidx.room:room-testing:$room_version"
}
build.gradle project:
buildscript {
ext.kotlin_version = '1.3.72'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.0.1'
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 {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I added this:
configurations.all() {
resolutionStrategy.force "org.antlr:antlr4-runtime:4.5.3"
resolutionStrategy.force "org.antlr:antlr4-tool:4.5.3"
}
becouse if i dont i got the "ANTLR Tool version 4.5.3 used for code generation does not match the current runtime version 4.7.1ANTLR Runtime version 4.5.3 used for parser compilation does not match the current runtime version 4.7.1" exception
I have some suggestions that may help some folks with auto-regenerating the ANTLR4 code for use on Android with Android Studio and Gradle. A complete working example of my setup is found with my project here.
First, to answer part of the poster's question. The org.antlr:antlr4-runtime:4.5.3 and org.antlr:antlr4-tool:4.5.3 packages seem dated. Even though many older posts suggest using these dependencies. I have found that the following will include the most recent version of ANTLR4 (check the ANTLR4 repository for updated versions):
dependencies {
// ...
implementation 'org.antlr:antlr4:4.9.1'
}
With typical Android applications, we need to apply the following stock plugin first:
apply plugin: 'com.android.application'
The problem is that this breaks Gradle's use with the ANTLR4 plugin. A work around is to install the antlr4 utility in your shell path and then do something like the following in the application build.gradle configuration:
/* NOTE: The gradle plugin with Android does not work, this is a shell command within the standard system paths. */
def generateAntlrJava(String grammarFile) {
def scriptRunCmd = "antlr -o app/src/main/antlr-gen -package 'com.my.package.name' -Dlanguage=Java" +
" -listener -visitor -long-messages -lib 'path/to'" +
" -Xexact-output-dir 'path/to" + grammarFile + "'";
def cmdResult = ['bash', '-c', scriptRunCmd].execute();
cmdResult.waitFor();
return cmdResult.text
}
task PreBuildGenAntlr4JavaSources {
println 'REMOVING OLD ANTLR4 JAVA SOURCES ==> '
file(new File('app/src/main/antlr-gen')).deleteDir()
println 'GENERATING ANTLR4 JAVA SOURCES ==> '
file(new File('app/src/main/antlr-gen')).mkdirs()
generateAntlrJava("MyScriptLexer.g4")
generateAntlrJava("MyScriptParser.g4")
outputs.upToDateWhen { false } /* Make the task run every time (no UP-TO-DATE skippage) */
}
preBuild.dependsOn PreBuildGenAntlr4JavaSources
task cleanPreBuildGenAntlr4JavaSources {
println 'REMOVING OLD ANTLR4 JAVA SOURCES ==> '
file(new File('app/src/main/antlr-gen')).deleteDir()
println 'GENERATING ANTLR4 JAVA SOURCES ==> '
file(new File('app/src/main/antlr-gen')).mkdirs()
generateAntlrJava("MyScriptLexer.g4")
generateAntlrJava("MyScriptParser.g4")
}
clean.dependsOn cleanPreBuildGenAntlr4JavaSources
That's it. The only solution that worked for my use case :)
I am trying to publish my android library on jitpack.io but when I tried to add dependency to test my artifact I am getting this error:
Unable to resolve dependency for ':app#debug/compileClasspath': Could not resolve com.github.pashaoleynik97:GSBarcodeScannerHelper:0.1.1-alpha.
Open File
Show Details
Unable to resolve dependency for ':app#debugAndroidTest/compileClasspath': Could not resolve com.github.pashaoleynik97:GSBarcodeScannerHelper:0.1.1-alpha.
Open File
Show Details
Unable to resolve dependency for ':app#debugUnitTest/compileClasspath': Could not resolve com.github.pashaoleynik97:GSBarcodeScannerHelper:0.1.1-alpha.
Open File
Show Details
Unable to resolve dependency for ':app#release/compileClasspath': Could not resolve com.github.pashaoleynik97:GSBarcodeScannerHelper:0.1.1-alpha.
Open File
Show Details
Unable to resolve dependency for ':app#releaseUnitTest/compileClasspath': Could not resolve com.github.pashaoleynik97:GSBarcodeScannerHelper:0.1.1-alpha.
Open File
Show Details
My gradle files in library project are listed below.
My build.gradle (app):
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.github.pashaoleynik97.gsbarcodescannerhelperdemo"
minSdkVersion 21
targetSdkVersion 28
versionCode 2
versionName "1.1"
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:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
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 project(':gsbarcodescannerhelper')
}
My build.gradle (gsbarcodescannerhelper):
apply plugin: 'com.android.library'
group='com.github.pashaoleynik97;'
android {
compileSdkVersion 28
defaultConfig {
minSdkVersion 21
targetSdkVersion 28
versionCode 2
versionName "0.1.1"
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:28.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'
implementation 'org.jetbrains.kotlin:kotlin-stdlib:1.3.10'
implementation(name: 'generalscan-sdk-1.0.6', ext:'aar')
}
And finally, my build.gradle (project):
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
flatDir {
dirs project(':gsbarcodescannerhelper').file('libs')
}
maven { url 'https://jitpack.io' }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I pushed my project on github, created release (through github web interface), then went to jitpack.io and published my library. But when I tried to add this library to my new test project I had errors (listed in top of this post). What I am doing wrong?
UPD
I also tried to add classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1' like in this docs: https://jitpack.io/docs/ANDROID/
But result remains the same.
UPD 2
Created issue: https://github.com/jitpack/jitpack.io/issues/3758
This seems to be a persisting issue for a few days, can be found here, the link mentions a workaround here. The workaround is to add www with the jitpack.io. Hence update it to the following:
maven { url 'https://www.jitpack.io' }
Jitpack is very sensative tool. There are a multitude of reasons why this issue comes up. I will try to itemized them.
1) Failing Unit Tests; if you have any failing unit tests, you will be able to create the artifact on jitpack (with no reported issues) but will be unable to reference the artifact. Make sure all your unit tests are working properly.
2) It is advisable that you include in your project level gradle for the project intended to be the artifact, the following:
Top of Project Level Gradle
apply plugin: 'maven-publish'
group = '<add-your-package-name-here>'
and at the very bottom of your project level gradle include
apply from: 'https://raw.githubusercontent.com/sky-uk/gradle-maven-plugin/master/gradle-mavenizer.gradle'
Now generate an artifact and see if the reference works
3) Private artifact? Maybe you are not referencing your artifact correctly. If your repo is private, be sure to add the auth token in gradle.properties and then reference it on the project level gradle like this,
gradle.properties
authToken=jp_myfake_token
Project Level Gradle:
maven {
url "https://jitpack.io"
credentials{ username authToken }
}
4) Wait a hour. For whatever reason there is syncing and caching issues with Jitpack. Sometimes all you have to do is wait a hour (or two) and everything starts to work.
Hopefully one of these will help you resolve your issue. Jitpack has easy setup, but it is buggy.
make sure that you add maven { url "https://jitpack.io" }
in build.gradle (Project Level) like this:
allprojects {
repositories {
google()
jcenter()
maven { url "https://jitpack.io" }
}
}
also, make sure that's your Gradle offline mode is disabled
Now it is free only for public repositories...
If you put your repository url in https://jitpack.io and looked up, you will see the following message as log:
Subscription not active
My Project Sync is failing with the below errors -
Unable to resolve dependency for ':app#debug/compileClasspath': Could not download exoplayer-core.aar (com.google.android.exoplayer:exoplayer-core:r2.4.2)
Unable to resolve dependency for ':app#debugAndroidTest/compileClasspath': Could not download exoplayer-core.aar (com.google.android.exoplayer:exoplayer-core:r2.4.2)
Unable to resolve dependency for ':app#debugUnitTest/compileClasspath': Could not download exoplayer-core.aar (com.google.android.exoplayer:exoplayer-core:r2.4.2)
Unable to resolve dependency for ':app#release/compileClasspath': Could not download exoplayer-core.aar (com.google.android.exoplayer:exoplayer-core:r2.4.2)
Unable to resolve dependency for ':app#releaseUnitTest/compileClasspath': Could not download exoplayer-core.aar (com.google.android.exoplayer:exoplayer-core:r2.4.2)
My Project build.grade looks like this -
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
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 {
jcenter()
google()
maven {
url "https://maven.google.com"
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
And my App gradle file looks like -
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
buildToolsVersion '28.0.3'
defaultConfig {
applicationId "com.android.application"
minSdkVersion 15
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'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.google.android.gms:play-services-ads:17.1.2'
implementation 'com.google.android.gms:play-services-analytics:16.0.6'
testImplementation 'junit:junit:4.12'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.facebook.android:audience-network-sdk:5.1.0'
}
Any help in this regard would be appreciated!!!
How do I resolve this??
I have tried Invalidate Caches/Restart option and also tried to rebuild the project but it didn't help..
It seems that Exoplayer-core and Exoplayer-dash are broken since today
https://github.com/google/ExoPlayer/issues/5225
By this Gradle configuration it works fine :
android {
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
compileSdkVersion 27
defaultConfig {
...
targetSdkVersion 27
...
}
}
ext {
exoplayer_version = '2.9+'
}
dependencies {
...
//exoplayer
implementation ('com.google.android.exoplayer:exoplayer-core:' + exoplayer_version)
implementation ('com.google.android.exoplayer:exoplayer-dash:' + exoplayer_version)
implementation ('com.google.android.exoplayer:exoplayer-hls:' + exoplayer_version)
implementation ('com.google.android.exoplayer:exoplayer-smoothstreaming:' + exoplayer_version)
implementation ('com.google.android.exoplayer:exoplayer-ui:' + exoplayer_version)
implementation ('com.google.android.exoplayer:exoplayer:' + exoplayer_version)
So for sure if you didn't include exoplayer library in your
build.gradle, your project won't synch.
UPDATE:
Okay, sorry, now I got the problem you all using com.facebook.android:audience-network-sdk have experienced these days, and why in your build.gradle file there is not exoplayer dependency set.
Using com.facebook.android:audience-network-sdk that depends on exoplayer, if you didn't explicitly specify exoplayer-core and exoplayer-dash, gradle try to download the necessary dependency as for docs.
So, as #laylakn pointed out (upvoted for that) there where an issue between repository mirroring between bintray and jcenter.
So, specifically to your problem, since you have told me that you have tried adding the libraries and synch without success, that's because the version of exoplayer you are looking for (r2.4.2) is in the spring plugin repository.
So you should add it as your maven repo (because of the mirroring error of repositories stated before):
maven {
url "https://repo.spring.io/plugins-release/"
}
Or as explain on main GitHub repo, just pointing directly to bintray.
maven {
url 'https://google.bintray.com/exoplayer/'
}
and you should synch your project adding this two libraries:
implementation 'com.google.android.exoplayer:exoplayer:r2.4.2'
implementation 'com.google.android.exoplayer:exoplayer-smoothstreaming:r2.4.4'
So now I'm glad to here from you that the mirroring problem has been resolved and are you able to sync right now, without doing any changes to your build.gradle files.
I've left and updated my answer to better explain this situation.
Also some other famous repo take precautions: [-:
I am developing an application and I am getting the following error:
error: cannot access zzbgl
class file for com.google.android.gms.internal.zzbgl not found
I know there's a question here in StackOverflow with the same error that I'm getting posted 4 days ago but the answer did not help in my case. (I am talking about this one)
The error appeared just right after setting Firebase Analytics in my project.
My build.gradle (Module: app) file is this:
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
android {
compileSdkVersion 26
buildToolsVersion '27.0.3'
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId 'com.geoactio.montferri'
minSdkVersion 14
targetSdkVersion 26
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
dependencies {
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.android.support:appcompat-v7:26.1.0'
// compile 'com.google.code.ksoap2-android:ksoap2-android:3.6.0'
implementation 'com.google.android.gms:play-services:12.0.1'
//implementation 'com.google.android.gms:play-services-maps:15.0.1'
//implementation 'com.google.android.gms:play-services-location:15.0.1'
implementation "com.google.android.gms:play-services-base:15.0.1"
implementation 'com.navercorp.pulltorefresh:library:3.2.3#aar'
}
productFlavors {
}
lintOptions {
disable 'MissingTranslation'
}
dexOptions {
javaMaxHeapSize "4g"
preDexLibraries = false
}
}
repositories {
maven { url 'https://oss.sonatype.org/content/repositories/ksoap2-android-releases' }
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.google.firebase:firebase-messaging:17.1.0'
implementation('com.crashlytics.sdk.android:crashlytics:2.9.4#aar') {
transitive = true;
}
}
apply plugin: 'com.google.gms.google-services'
My build.gradle (Project: myPorojectName) file is this:
buildscript {
repositories {
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
classpath 'com.google.gms:google-services:4.1.0'
}
}
allprojects {
repositories {
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
}
And clicking in the error leads me here, just after new MarkerOptions():
mapView.addMarker(new MarkerOptions().position(new LatLng(puntomarker.getLatitud(), puntomarker.getLongitud()))
.zIndex(0.5f)
.anchor(0.5f, 0.5f)
.title(puntomarker.getId() + "")
.snippet(puntomarker.getNombre())
.icon(BitmapDescriptorFactory.fromBitmap(((BitmapDrawable) marker).getBitmap())));
(being mapView a GoogleMap instance).
I hope someone can see the error and solve this, thank you so much in advance.
If you need any more information in order to solve this, please let me know.
The Google API Release Notes indicate that support for the combined play-services library ended in April 2018:
Starting with 15.0.0, there will no longer be a play-services alias target to pull in all Google Play services components. This has been recommended against for some time.
You can no longer specify a single dependency on the combined Google Play services target like this anymore:
implementation 'com.google.android.gms:play-services:12.0.1'.
When this was supported with previous versions, it pulled in ALL the Google Play libs way more than you need. See the list of APIs in Table 1 of the Setup Guide and include only the specific ones your app uses.
A check of the Google Maven Repository confirms that version 12.0.1 was the last version of the combined play-services target.
So please delete the above implementation and use only:
implementation "com.google.android.gms:play-services-base:15.0.1"
If you are also using other play services, please add them as separate dependencies.
I think your main reason for the error is that you are using 2 different versions for play services libraries
implementation 'com.google.android.gms:play-services:12.0.1'
Here it is 12.0.1
implementation "com.google.android.gms:play-services-base:15.0.1"
While here it is 15.0.1.
Try to use same version of related libraries everywhere.
Just simply you need to change a Dependency because 12.0.1 is no more
implementation 'com.google.android.gms:play-services:12.0.1'
To
implementation 'com.google.android.gms:play-services-base:15.0.1'
And press sync Gradle
Hope this may help you
updates the version of all dependencies.
Generally, this error will happen if you are working with several new and old dependencies.