Android studiogradle project sync failed - android

hi guys i am a newbie in Android Studio and i have a problem with my gradle project it brings up this message;
Could not get unknown property '' for DefaultExternalModuleDependency{group='com.android.support', name='animated-vector-drawable', version='25.2.0', configuration='default'} of type org.gradle.api.internal.artifacts.dependencies.DefaultExternalModuleDependency.Kindly Assist.
code for app level gradle build
android {
compileSdkVersion 26
buildToolsVersion "26.0.0"
defaultConfig {
applicationId "com.example.sarah_njeri.theroscaapp"
minSdkVersion 15
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'
}
}
}
dependencies {
compile 'com.android.support:animated-vector-drawable:25.2.0'''
compile 'com.android.support-compact:25.3.1'
compile 'com.google.android.gms:play-services:10.0.1'
compile 'com.google.firebase:firebase-database:10.0.1'
compile 'com.android.support:support-vector-drawable:26.3.1'
}
apply plugin: 'com.google.gms.google-services'

compile 'com.android.support:animated-vector-drawable:25.2.0'''
you have added two extra ' there just delete it
compile 'com.android.support:animated-vector-drawable:25.2.0'

Related

How to build a jar/aar with dependencies in android studio?

I had a project library in android studio with following dependencies.
apply plugin: 'com.android.library'
android {
compileSdkVersion 26
defaultConfig {
minSdkVersion 19
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'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])//Local binary dependency
implementation 'com.android.support:appcompat-v7:26.1.0'//Remote binary dependency
api group: 'com.google.collections', name: 'google-collections', version: '1.0'
My question is how to build a jar/aar with dependencies?
I have tried many ways but it did not including "google-collections" dependency in exported jar/aar?
how can I do that?
Thanks.

Unable to add Gradle Dependency

I am trying to add this dependency to gradle, but I am receiving the below errors about other dependencies which I have not added in the first Place.
Errors :
Dependency I am trying to add is com.wdullaer:materialdatetimepicker:3.1.3
build.gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.pf.datetimepicker"
minSdkVersion 21
targetSdkVersion 24
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
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:+'
compile 'com.wdullaer:materialdatetimepicker:3.1.3'
}
which I have not added in the first Place.
Sure you did...
Look at the source of the library you got. https://github.com/wdullaer/MaterialDateTimePicker/blob/master/library/build.gradle
compile 'com.android.support:support-v4:25.2.0'
compile 'com.android.support:support-v13:25.2.0'
compile 'com.android.support:design:25.2.0'
First, you need compileSdkVersion 25 for those to even work, then you need to allow Android Studio to "Install Repository and Sync Project" or do it yourself by updating the SDK Manager.
Change your compile and targetsdk to 25
Change your compileSdkVersion, buildToolsVersion andtargetSdkVersion
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.pf.datetimepicker"
minSdkVersion 21
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'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:+'
compile 'com.wdullaer:materialdatetimepicker:3.1.3'
}
You have not installed the newest version of android support libraries. Just open SDK manager and install them. See the image

Android bottom-navigation

Hi everyone I'm new to android, what I'm trying to add on my learner app is the bottom navigation but I'm getting the error when I build the project:
build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.example.asussonicmaster.nonameapp"
minSdkVersion 15
targetSdkVersion 24
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.roughike:bottom-bar:1.2.1'
}
What am I doing wrong here,
Error:Execution failed for task ':app:processDebugManifest'.
Error: [C:\Users\ASUS Sonic Master\AndroidStudioProjects\NoNameApp\app\build\intermediates\exploded-aar\com.android.support\appcompat-v7\23.2.0\AndroidManifest.xml:21] Invalid instruction 'overrideLibrary', valid instructions are : REMOVE,REPLACE,STRICT
It's better to keep the build version, compile version and the google libs at the same version.
Try this:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.example.asussonicmaster.nonameapp"
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.roughike:bottom-bar:1.2.1'
}

this support library should not use a different version

I've seen a lot of people having a similar problem and the solution was a change of version on either the compileSdkVersion or the Support Libraty Version.
Here my problem is that I do have the same compileSdkVersion and the same Support Library Version but the error still shows.
This is my build.gradle
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "my.package.com"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
ext {
supportLibVersion = '23.4.0'
}
dependencies {
compile "com.android.support:appcompat-v7:${supportLibVersion}"
compile "com.android.support:design:${supportLibVersion}"
compile "com.android.support:cardview-v7:${supportLibVersion}"
compile "com.android.support:recyclerview-v7:${supportLibVersion}"
compile "com.android.support:support-v4:${supportLibVersion}"
}
The error:
This support library should not use a different version(24) than the compileVersionSDK(23)
The error began to show right after I updated to Android Studio 2.2

Android Studio telling me it cannot resolve symbols?

Android Studio was telling me it couldn't resolve some symbols in my code. After research, it was apparent that my project was API level 23, which wasnt compatible with some of the code. I decided to change it to API level 21.
Below is the previous code in my build.gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.scriptdesigninc.test_app"
minSdkVersion 8
targetSdkVersion 23
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:23.0.1'
}
I was told that I have to change it to the following,
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.scriptdesigninc.test_app"
minSdkVersion 14
targetSdkVersion 21
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.0'
}
After I changed it, it told me I am missing the API package and that I have to download it, which I did. Then I clicked "retry" and it said it was unable to sync gradle project.
Please help, thank you in advance.
dependencies {
compile 'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2'
}
Add the above dependency in your build.gradle file.
This is happening because Android M does not supports the Apache HTTP API

Categories

Resources