Android studio download resource not compile in dependencies - android

I've always programed Android with Eclipse and decided to start migrating to Android Studio.
In my project, I added some libraries...
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
/* For Google Play Services */
//Firebase
compile 'com.android.support:appcompat-v7:23.+'
compile 'com.android.support:design:23.+'
compile 'com.android.support:support-v4:23.+'
compile 'com.android.support:cardview-v7:23.+'
compile 'com.google.android.gms:play-services-safetynet:8.3.0'
compile 'com.google.android.gms:play-services-auth:8.3.0'
compile 'com.firebase:firebase-client-android:2.3.0'
compile 'com.firebaseui:firebase-ui:0.2.2'
}
I got error in build gradle.
Error:A problem occurred configuring project ':app'.
> Could not download firebase-client-jvm.jar (com.firebase:firebase-client-jvm:2.3.0)
> Could not get resource 'https://jcenter.bintray.com/com/firebase/firebase-client-jvm/2.3.0/firebase-client-jvm-2.3.0.jar'.
> Could not GET 'https://jcenter.bintray.com/com/firebase/firebase-client-jvm/2.3.0/firebase-client-jvm-2.3.0.jar'.
> peer not authenticated
I released that: I didn't add firebase-client-jvm-2.3.0 library to complie. But I got this error.
I tried this but issue is not resolve.
Could you explain and help me resolve it?

Possible duplicate of Gradle Could not HEAD https://..pom > peer not authenticated - you should use HTTP instead of HTTPS in repo URL:
repositories {
jcenter {
url "http://jcenter.bintray.com/"
}
}

Related

Unresolved dependencies: com.android.support.constraint:constraint-layout:1.0.1

I downloaded Android Studio for the first time and encountered a problem:
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.1'
testCompile 'junit:junit:4.12'
On a another dock appeared:
ERROR: Failed to resolve: com.android.support.constraint:constraint-layout:1.0.1
Show in Project Structure dialog
Affected Modules: app
Where and how can I resolved the issue?
I believe the error is with constraint-layout:1.0.1 but I can't seem to find solution else where.
You should connect to internet and sync project with gradle and gradle will download neccessary files.if you have problem to connect to the internet to download gradle, you can set http proxy this way :
File->Settings->search for Proxy->select Manual proxy configuration->HTTP
Host name:[yourHost] Port number:[yourPort]
you need to change the Host name to the proxy you use
ERROR: Failed to resolve: com.android.support.constraint:constraint-layout:1.0.1 Show in Project Structure dialog Affected Modules: app
It's probably because incompatibility with the recent Android Studio. You can try using version 1.0.2 with:
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
don't forget to add the google() maven to your build.gradle.
See the artifacts at https://mvnrepository.com/artifact/com.android.support.constraint/constraint-layout
But, you should consider upgrading your project to AndroidX. See Migrating to AndroidX.

Unable to resolve dependency for 'com.google.ads.mediation:inmobi:6.2.0.0'

i am implementing Admob mediation in my application details are here
when i trying to add inmobi in cause the below error for adding compile 'com.google.ads.mediation:inmobi:6.2.0.0'in gradle dependencies
Unable to resolve dependency for ':app#debug/compileClasspath': Could not resolve com.google.ads.mediation:inmobi:6.2.0.0.
Could not resolve com.google.ads.mediation:inmobi:6.2.0.0.
Required by:
project :app
> No cached version of com.google.ads.mediation:inmobi:6.2.0.0 available for offline mode.
gradle file look like below
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:support-v13:26.1.0'
compile 'com.android.support:recyclerview-v7:26.1.0'
compile 'com.google.android.gms:play-services-ads:11.4.2'
compile 'com.google.android.gms:play-services-location:11.4.2'
compile 'com.google.android.gms:play-services-gcm:11.4.2'
compile('com.vungle:publisher-sdk-android:5.3.0#aar') {
transitive=true
}
compile 'com.google.ads.mediation:vungle:5.3.0.0'
compile 'com.inmobi.monetization:inmobi-ads:6.2.0'
compile 'com.google.ads.mediation:inmobi:6.2.0.0'
}
there is also option for manual integration link for get the adapter file but there is no such adapter with same version
can any one explain how to resolve this.
Go to Preferences in Android Studio
Go to Gradle tab and uncheck "Offline work" if it is checked
Check if your PC has active internet connectivity
Sync your project again & you are good to go!
The min version of InMobi adapter is 6.2.3 : Link
Replace the gradle dependency to look something like this :
compile 'com.google.ads.mediation:inmobi:6.2.4.0'
PS: 6.2.4 is backward compatible with 6.2.0
Try updating the adapter and you can find the dependencies here
Also, try adding inmobi alone and take out vungle dependencies.

Failed resolving dependencies due to OneSignal

I found the following question: Failed to resolve: com.android.support:customtabs:[26.0.0,26.1.0]
People marked it as duplicate (which is wrong ! see next sentence) or wrote something about Maven or cleaning project etc.
I have exactly the same problem for two days (failed to resolve customtabs and support-v4) and I did not change anything in my project which has been previously working. So I started looking for possible solutions and I found the problem - it is the OneSignal dependency - when I remove it, everything works fine. But I have already implemented notifications in my app - and don't know what to do now. I tried to compile the newest one (mentioned on OneSignal page)
compile 'com.onesignal:OneSignal:[3.6.0,3.99.99)'
But the result is same. Can anyone help?
UPDATE:
The problem can be very easy reproduced - please create a simple project and add this dependency mentioned below (it is from official OneSignal website https://documentation.onesignal.com/v3.0/docs/android-sdk-setup):
compile 'com.onesignal:OneSignal:[3.6.0, 3.99.99]'
UPDATE 2:
These are my dependencies:
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.google.firebase:firebase-auth:10.0.1'
compile 'com.google.firebase:firebase-database:10.0.1'
compile 'com.firebaseui:firebase-ui-database:1.1.0'
compile 'com.android.support:design:25.3.1'
compile 'com.onesignal:OneSignal:[3.6.0, 3.99.99]'
Adding
maven {
url "https://maven.google.com"
}
to the build.gradle solved the problem with OneSignal, but now I have a problem with Firebase:
java.lang.NoSuchMethodError: No static method zzdD(Ljava/lang/String;)Z in class Lcom/google/android/gms/common/util/zzv; or its super classes (declaration of 'com.google.android.gms.common.util.zzv'
The error happens because you have some conflicted library in your dependency.
As in the documentation, it says:
Automatic Dependencies
OneSignal automatically adds the following dependencies;
com.google.android.gms - Version 11
com.android.support - Version 26
Please makes sure your project matches these versions if you run into
a mismatch version error.
For more details see the All gms/firesbase libraries must use the
exact same version specification section.
So, you need to remove or use the same dependencies in your project, something like this:
compile 'com.android.support:appcompat-v7:26.0.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.google.firebase:firebase-auth:11.0.+'
compile 'com.google.firebase:firebase-database:11.0.+'
compile 'com.firebaseui:firebase-ui-database:1.1.0'
compile 'com.android.support:design:26.0.+'
compile 'com.onesignal:OneSignal:[3.6.0, 3.99.99]'
Remove 'f' from dependency. also, use [ brackets instead of ). its a typo.
dependencies {
compile 'com.onesignal:OneSignal:[3.6.0, 3.99.99]'
}
and this code in your root gradle file
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}

Android Firebase Email and password authentication does not work

I am trying to create accounts in an Android app using Firebase. When I add the following dependencies in the app build.grade file -
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.firebase:firebase-client-android:2.5.2'
compile 'com.firebaseui:firebase-ui:1.0.1'
compile 'com.google.firebase:firebase-auth:10.0.0'//added also tried 10.0.1
testCompile 'junit:junit:4.12'
}
I get the following cryptic build error (btw I'm not using any Twitter SDKs or anything to the best of my knowledge):
Error:Failed to resolve: com.twitter.sdk.android:twitter:2.2.0
When I change the dependecies to:
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.firebase:firebase-client-android:2.5.2'
compile 'com.firebaseui:firebase-ui:0.6.2'//changed
compile 'com.google.firebase:firebase-auth:9.8.0'//changed
testCompile 'junit:junit:4.12'
}
the app build and compiles fine, but when I try to create the account, I get the following error:
Projects created at console.firebase.google.com must use the new Firebase Authentication SDKs available from firebase.google.com/docs/auth/
I am at a loss as to what I should do because I think I'm using the latest version of the Firebase SDK.
Some more information is that I have used both mFirebaseRef.createUser() and mAuth.createUserWithEmailAndPassword with no success.
I used this link to change the dependencies.
Any help will be deeply appreciated.
You are mixing the legacy SDK:
compile 'com.firebase:firebase-client-android:2.5.2'
with the new SDK:
compile 'com.google.firebase:firebase-auth:10.0.0'
This will cause a number of problems and is the reason for this error message:
Projects created at console.firebase.google.com must use the new Firebase Authentication SDKs available from firebase.google.com/docs/auth/
For new development, you should use only the new SDK. Delete this line from your dependencies:
compile 'com.firebase:firebase-client-android:2.5.2'
The latest versions of FirebaseAuth require additional repositories. Make this change to your project (top-level) build.gradle file:
allprojects {
repositories {
jcenter()
maven { url 'https://maven.fabric.io/public' }
mavenLocal()
}
}
The change is excerpted from the Firebase Sample project. It will eliminate this error:
Error:Failed to resolve: com.twitter.sdk.android:twitter:2.2.0
you should use the correct firebase authentication version from Google:
compile 'com.google.firebase:firebase-auth:10.0.1'
And you have to setup Firebase as it is described in the official documentation

Android Ormlite: java.lang.NoClassDefFoundError

I am using ormlite in an Android project from Android Studio. I have configured Gradle to use it from Maven, like so:
dependencies {
compile 'com.j256.ormlite:ormlite-core:4.48'
compile 'com.j256.ormlite:ormlite-android:4.48'
However, when I launch the app it's giving NoClassDefFoundError for all ormlite classes. The same works if it is done by copying the jars to "libs/" folder.
Any idea why adding them from Maven doesn't work?
Try this on build.gradle:
dependencies {
compile 'com.j256.ormlite:ormlite-android:4.48'
...
}
The ormlite-core is a dependency that gradle will resolve by it's self. After editing, sync and rebuild you app, it should work.
If you want to put jar files in you libs folder, than your dependecies line from build.gradle will look like this:
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
...
}

Categories

Resources