Problems with dependencies. Integrating MapBox in Android Studio - android

I have some problems with integration MapBox SDK into my project.
Here is description how to add dependency into Gradle:
https://www.mapbox.com/mapbox-android-sdk/#gradle
So, I should add this into my build.gradle:
repositories {
mavenCentral()
}
dependencies {
compile ('com.mapbox.mapboxsdk:mapbox-android-sdk:0.7.4#aar'){
transitive=true
}
}
After that my build.gradle looks like:
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.samusko.journeyproject"
minSdkVersion 15
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
mavenCentral()
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:22.1.1'
compile 'com.android.support:cardview-v7:22.1.1'
compile ('com.mapbox.mapboxsdk:mapbox-android-sdk:0.7.4#aar'){
transitive=true
}
}
When I compile this I have this error:
Error:Failed to resolve: com.android.support:support-v4:22.2.0
I don't know what is wrong :(.
Please help me to resolve this error..

You are missing this line in the gradle file, put it before the "com.mapboxsdk:..." line (the support libraries you used were too old):
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
##### begin fix
# modified 2.1.1 to 2.2.0
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.android.support:cardview-v7:22.2.0'
##### end fix
compile ('com.mapbox.mapboxsdk:mapbox-android-sdk:0.7.4#aar'){
transitive=true
}
}
Note that this version of MapBox is no longer supported upstream. They deprecated it, even tough (IMHO) as I am writing this message the new API is not usable enough.

Related

Failed to resolve: com.android.support.design:21.0.3

I added the following line to my build.gradle(Module:app):
compile 'com.android.support:design:21.0.3'
But when executing Gradle I'm getting
Failed to resolve: com.android.support.design:21.0.3
I got that code from the android support design library and added it to a new project. I added it to the dependency section as such:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.2"
defaultConfig {
applicationId 'com.solodroid.androidnewsapp'
minSdkVersion 17
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'
}
}
productFlavors {
}
}
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:21.0.3'
compile 'com.android.support:design:21.0.3'
compile 'com.google.android.gms:play-services:6.5.87'
compile 'com.android.support:recyclerview-v7:21.+'
compile files('libs/StartAppInAppPlus-2.3.jar')
}
Use the same version of appcompat as your sdk version. Also in newer android studio use implementation keyword.
implementation 'com.android.support:appcompat-v7:26.1.0'
IMP
Or first check your sdk that you have downloaded the version 21.0.3.
You should add official google repository in app gradle. Also on project gradle if other modules need that repository.
apply plugin: 'com.android.application'
buildscript {
repositories {
google()
}
}
...
android {
...

android - could not find support-annotations.jar

I'm trying to sync project with Gradle. But gradle gives some error.
The error code like this : Error:A problem occurred configuring project ':app'.
Could not find support-annotations.jar (com.android.support:support-annotations:24.0.0).
Searched in the following locations:
https://jcenter.bintray.com/com/android/support/support-annotations/24.0.0/support-annotations-24.0.0.jar
My build.gradle file :
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "24.0.1"
repositories {
mavenCentral()
}
defaultConfig {
applicationId "com.example.ileem.tiiu"
minSdkVersion 16
targetSdkVersion 24
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.0.0-alpha2'
compile 'com.android.support:design:24.0.0-alpha2'
compile 'com.facebook.android:facebook-android-sdk:4.0.0'
compile 'com.google.android.gms:play-services:9.0.0'
compile 'com.google.maps.android:android-maps-utils:0.4'
compile 'com.google.firebase:firebase-messaging:9.6.1'
compile 'com.squareup.okhttp3:okhttp:3.2.0'
compile files('libs/gson-2.2.4.jar')
compile files('libs/jsoup-1.10.1.jar')
}
apply plugin: 'com.google.gms.google-services'
Try upgrading to the latest version of the build tools and support libraries. You can find them here.

While adding any new dependencies in android build.gradle file. it always show an error

Error:(42, 13) Failed to resolve: com.android.volley:volley:1.0.0
When add any dependencies in android build.gradle file it always shows the above error. But same project is running on a different machine same dependencies can add successful. I search lot for solving this problem but can't find any solution. Kindly Please help me to fix the problem Thank you.
I face the same error while adding any dependencies now, but few weeks before i can add any dependencies on my project
build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "24.0.0"
defaultConfig {
applicationId "myappid"
minSdkVersion 17
targetSdkVersion 24
versionCode 1
versionName "1.0"
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
jcenter({url "http://jcenter.bintray.com/"})
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.0.0'
compile 'com.android.support:design:24.0.0'
compile 'com.android.support:cardview-v7:24.0.0'
compile 'com.android.support:recyclerview-v7:24.0.0'
compile 'com.android.support:support-vector-drawable:24.0.0'
// VectorDrawableCompat
compile 'com.android.support:animated-vector-drawable:24.0.0'
compile 'com.android.support:support-annotations:24.0.0'
compile 'com.satsuware.lib:usefulviews:2.3.6'
compile 'com.github.ganfra:material-spinner:1.1.1'
compile 'com.google.android.gms:play-services-appindexing:8.1.0'
compile 'com.ramotion.foldingcell:folding-cell:1.0.1'
compile 'com.android.volley:volley:1.0.0'
}
I try many way to solve the problem i have faced but no one can rectify the problem. I ask the help of may experience developer, they told me that they never face such a problem in there life. So only solution i found is to reinstall android studio. Now it work perfectly. Any way thanks for your support.

AndroidAnnotations can not find Android Manifest when compile

I am working at Windows 7 OS, Android Studio. After compiling AndroidAnnotation framework, I can not compile project. Right during the process of compiling it responds with "Error:Could not find the AndroidManifest.xml file, using generation folder"
My gradle file is:
android {
compileSdkVersion 24
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.falcodeceo.beautifulmind"
minSdkVersion 16
targetSdkVersion 24
versionCode 23
versionName "2.3"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.2.0'
compile 'com.android.support:cardview-v7:24.2.0'
compile 'com.android.support:palette-v7:24.2.0'
compile 'com.android.support:appcompat-v7:24.2.0'
compile 'com.eightbitlab:blurview:1.1.2'
compile 'org.androidannotations:androidannotations:4.1.0'
}
Looked through some answers but can not apply it, as I do not understand how it works. So I will be thankful if you explain how it all goes.
You miss some necessary configuration. Just add following parts to your Gradle file
buildscript {
dependencies {
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
}
}
apply plugin: 'android-apt'
dependencies {
apt "org.androidannotations:androidannotations:4.1.0"
}
apt {
arguments {
androidManifestFile variant.outputs[0]?.processResources?.manifestFile
}
}
More details can be found at androidannotations wiki https://github.com/excilys/androidannotations/wiki/Building-Project-Gradle

Wrong xml being inflated android

I have a library project which had colliding xml names like activity_login,etc..
Now even though this is the case when I run the Actvity in the library project is inflating my xml instead of its own and subsequently throwing NPE.
I've already tried giving it the fully qualified R file name but it still seems to be inflating the wrong file.
Ps:I've tried clean build doesnt work either on AS1.2.1.1.
Is this a bug of AS or am I doing something wrong
Here is my gradle file
buildscript {
repositories {
maven { url 'http://download.crashlytics.com/maven' }
}
dependencies {
classpath 'com.crashlytics.tools.gradle:crashlytics-gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'crashlytics'
repositories {
maven { url 'http://download.crashlytics.com/maven' }
}
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.xxx"
minSdkVersion 14
targetSdkVersion 21
versionCode 17
versionName "2.4.3"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:21.0.+'
compile 'com.google.android.gms:play-services:6.5.+'
compile 'com.android.support:support-v4:21.0.+'
compile 'com.android.support:recyclerview-v7:22.0.+'
compile 'com.android.support:cardview-v7:21.0.+'
compile project('libraries:holograph')
compile project('libraries:facebook')
compile files('libs/google-api-client-android-1.18.0-rc.jar')
compile files('libs/google-api-client-java6-1.18.0-rc.jar')
compile files('libs/google-api-client-1.18.0-rc.jar')
compile 'com.crashlytics.android:crashlytics:1.+'
compile project(':chartlib')
compile project(':payu')
}
And build.gradle of payu is
apply plugin: 'com.android.library'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
minSdkVersion 8
targetSdkVersion 21
versionCode 2
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile('de.keyboardsurfer.android.widget:crouton:1.8.+#aar') {
exclude module: 'support-v7'
compile 'com.android.support:appcompat-v7:18.0.+'
}
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'de.greenrobot:eventbus:2.2.1'
compile 'com.loopj.android:android-async-http:1.4.6'
compile 'com.mobsandgeeks:android-saripaar:1.0.3'
compile project(':CustomBrowser')
}
And my Settings.gradle
include ':app', ':payUMoneysdk', ':CustomBrowser'
This is happening by design, consider it as overriding the library activity layout. I use it extensively for Strings, Colors etc. where it's more useful.
Just rename your projects XML layouts.

Categories

Resources