Importing android project error - android

Hi guys when im importing my android project I am getting an error 'Failed to resolve: com.android.support.constraint:constraint.layout:1.0.0.Please help.

try com.android.support.constraint:constraint.layout:1.0.0.
It looks like a simple typo.

Did you add the Google maven repository? Your allprojects part of your
project's build.gradle file should look something like this
allprojects {
repositories {
jcenter()
maven {
url 'https://maven.google.com'
}
}
}

Related

YoutubeExtratctor Android dependency Error

I have an error in this dependency
implementation 'com.github.HaarigerHarald:android-youtubeExtractor:v1.7.0'
and the error is
ERROR: Failed to resolve: com.github.HaarigerHarald:android-youtubeExtractor:v1.7.0
I'm trying to use it to fetch an url of youtube video so that I can use it in Exoplayer
Do you have already the jitpack.io added to your repositories config in the build.gradle file?
Something like
allprojects {
repositories {
google()
jcenter()
maven { url "https://jitpack.io" } // this is the line that you probably need
}
}
The idea is that gradle needs to know where to find artifacts build from github, this is usually from jitpack.io. By default, this line is not generated in the build.gradle file so you must add it manually.
Hope it helps

how to change default project structure dependencies

every time i create a new android studio project, the layout editor will be broken because the dependency com.android.support:appcompat-v7:28.0.0-alpha3 will spoil the layout editor with:
Render problem
Failed to load AppCompat ActionBar with unknown error.
Tip: Try to refresh the layout.
thanks to user JLC answer, the problem is solved, but if i create a new project, the problem will come back
so my question is how can i change it so that every new project will use dependency com.android.support:appcompat-v7:27.1.1 instead? thanks
If you are using Android Studio 3.0 and above then make sure you are using the same content in build.gradle like-
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
And for below Android Studio 3.0 and starting from support libraries 26.+ your project build.gradle must look like this-
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
For the detailed knowledge check the below docs-
Build Dependencies
Building Android apps
Configure your build

Failed to resolve Android Giphy SDK dependency

I am trying to add Giphy Android SDK in my Android Project. On Giphy SDK's documentation, it is mentioned that in your Project gradle.build file, add:
repositories {
maven {
url "https://giphy.bintray.com/giphy-sdk"
}
}
and in your module's gradle.build file add:
compile('com.giphy.sdk:core:1.0.0#aar') {
transitive=true
}
But when i am Syncing it, Android Studio is giving me an error saying:
Failed to resolve: com.giphy.sdk:core:1.0.0
Does anyone have any idea what am i missing?
Make sure to add the following line
repositories {
maven {
url "https://giphy.bintray.com/giphy-sdk"
}
}
under allprojects and not under buildscript like so
allprojects {
repositories {
google()
jcenter()
maven {
url "https://giphy.bintray.com/giphy-sdk"
}
}
}

Failed to resolve: com.github.jblough:Android-Pdf-Viewer-Library:v1.0

I want to install the following library in my project.
https://android-arsenal.com/details/1/348#!package
I have added the jar file in build folder
I also added the dependencies which are mentioned there.
I also added :
enter code here
maven {
url "https://jitpack.io"
}
But I found this error:
Please! help me to resolve this issue.
You can add this library in your gradle file
compile 'com.github.barteksc:android-pdf-viewer:2.8.2'
here's the link of the library just try it
I just added code in build.gradle file
allprojects {
repositories {
google()
jcenter()
mavenCentral()
}
}

Failed to resolve: com.github.PhilJay:MPAndroidChart:v2.1.4

I'm using MPAndroidChart library in android studio. But when I'm trying to sync gradle I get an error as shown in below image.
Gradle text is here to compile MPAndroidChart library.
compile 'com.github.PhilJay:MPAndroidChart:v2.1.4'
How can I resolve this problem?
Add
maven { url "https://jitpack.io" }
to repositories under allprojects not under buildscript see screenshot:
Above solutions did not work for me. I used below to get MPAndroidChart lib working on my project.
Downloaded the latest MPAndroidChart jar from: https://jitpack.io/com/github/PhilJay/MPAndroidChart/v3.0.1/MPAndroidChart-v3.0.1.jar
Copied the downloaded MPAndroidChart-v3.0.1.jar file to YourProject/app/lib directory
Compiled the following dependency at app level build.gradle
dependencies {
compile files('libs/MPAndroidChart-v3.0.1.jar')
}
re-sync the gradle
Go to build.gradle Add the maven { url 'https://jitpack.io' } in both buildscript{}
and allprojects{} as below :
buildscript {
repositories {
maven { url 'https://jitpack.io' }
}
}
allprojects {
repositories {
maven { url 'https://jitpack.io' }
}
}
Remember to Sync.
Putting
repositories {
maven { url "https://jitpack.io" }
}
in build.gradle in app folder fixed my issue!
The problem was solved after restarting Android Studio > rebuild project.
I solved this by putting maven { url 'https://jitpack.io' } inside repositories in settings.gradle
In Settings Gradle just add this following code:
allprojects {
repositories {
google()
jcenter()
maven { url "https://jitpack.io" }
}
}
for new android studio version set repository in settings.gradle file
repositories {
google()
mavenCentral()
maven { url "https://jitpack.io" }
// Warning: this repository is going to shut down soon
}
I had the same problem after adding this one in the gradle solved my problem:
repositories {
jcenter()
maven { url "https://jitpack.io" }
}
`
For me the issue was resolved by placing code in below order.
allprojects {
repositories {
google()
jcenter()
maven { url 'https://jitpack.io' }
maven { url "https://maven.google.com" }
}
}
You could encounter this issue if your gradle offline mode is enabled.
turn it off in android studio, Settings > Gradle and uncheck "Offline work" and sync.
I had to move maven { url 'https://jitpack.io' } to be the last declaration after google(), and jcenter().
As the Android studio is updated so you have to control your dependency form your setting.app
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
jcenter() // Warning: this repository is going to shut down soon
maven { url 'https://jitpack.io' }
}
}
Kindly place this line the respiratory
maven { url 'https://jitpack.io' } //as i have done above
Or just rebuild your project. Worked for me
Build-> Rebuild the project, then re-sync the gradle file.
One Problem can also be, that you are behind a proxy.
So there are two possibilities:
Add your proxy config to android Studio, ore you can also add a gradle.properties file in your project root.
there you have to enter the following credentials:
systemProp.http.proxyPassword=
systemProp.http.proxyHost=
systemProp.http.proxyUser=
systemProp.http.proxyPort=
systemProp.https.proxyPassword=
systemProp.https.proxyHost=
systemProp.https.proxyUser=
systemProp.https.proxyPort=
So the https Properties are pretty necessary. I figured out that often the repositories are available over both protocols. but sometimes only over http or https.
Run gradle wrapper task from command line
cd ~/AndroidStudioProject/myproject/myapp
./gradlew tasks
This worked for me.
If your under proxy add this lines in gradle properties(project properties)
systemProp.http.proxyHost= "Your proxy"
systemProp.http.proxyPort= "Proxy port"
systemProp.https.proxyHost= "Your proxy"
systemProp.https.proxyPort= "Proxy port"
The JitPack repository shouldn't be under buildscripts in this case. It should be just under repositories:
As you can see here on medium or here on the github you have to copy the lib of MPChart AND the Jetpack. There is no reason to fail if you do this.
Don't forgot jetpack.io

Categories

Resources