This question already has an answer here:
Import app compat dependency in all libraries
(1 answer)
Closed 5 years ago.
In my currently working project contains lot of modules and dependency. So is there is any way to keep all this versions and dependency common and reuse in all modules. I know that we can define common dependency in root build.gradle file but whats about things like compileSdkVersions and exclude groups.
My dependency some times include exclude group like.
androidTestCompile ('com.android.support.test:rules:1.0.1'){
exclude group: 'com.android.support', module: 'support-annotations'
exclude group: 'com.android.support', module: 'appcompat'
exclude group: 'com.android.support', module: 'support-v4'
exclude module: 'recyclerview-v7'
}
How can we handle this scenario?
Once we have add in root build.gradle, Is there any way to add them all in a app module with out specifying individual ones like below.
compile deps.cardview
compile deps.design
compile deps.supportv4
compile deps.animation
compile deps.pagination
compile deps.shimmerlayout
compile deps.enhanced_card
compile deps.swipeanim
compile deps.appcompact
For things like compileSdkVersion, buildTypes and compileOptions, I define sth like this in root gradle file :
ext.android_settings_for_module = {
compileSdkVersion COMPIlE_SDK_VERSION.toInteger()
buildToolsVersion BUILD_TOOLS_VERSION
defaultConfig {
minSdkVersion
targetSdkVersion
versionCode
versionName
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt')
}
}
compileOptions compile_options
lintOptions lint_options
testOptions test_options
}
ext.lint_options = {
//butterKnife
disable 'InvalidPackage'
}
ext.compile_options = {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
And then, in your module file, you can use :
android android_settings_for_module
Quite Similar for dependencies. Define a field in root gradle file :
ext.common_libs = [
]
And then use in module level gradle file :
dependencies {
compile common_libs
}
For sharing common SDK version and Dependencies. You can define shared gradle dependencies in the library module, and if the app module has the library as a dependency, you won't need to specify everything twice. Taking this further, you could create a 'common' module that requires the shared gradle dependencies, and have both the app & library module require the common module.
have look :
// Top-level build file where you can add configuration options common to
all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.3'
}
}
// Load dependencies
apply from: 'dependencies.gradle'
here is dependencies.gradle: for all module and sdk version in app.
ext {
//Version
supportLibrary = '22.2.1'
//Support Libraries dependencies
supportDependencies = [
design : "com.android.support:design:${supportLibrary}",
recyclerView : "com.android.support:recyclerview-v7:${supportLibrary}",
cardView : "com.android.support:cardview-v7:${supportLibrary}",
appCompat : "com.android.support:appcompat-v7:${supportLibrary}",
supportAnnotation: "com.android.support:support-annotations:${supportLibrary}",
]
}
Happy Coding!!
Related
I'm receiving both errors:
Could not create task ':processDebugGoogleServices'.
Cannot create a proxy class for abstract class 'GoogleServicesTask'.
// GENERATED BY UNITY. REMOVE THIS COMMENT TO PREVENT OVERWRITING WHEN EXPORTING AGAIN
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.0'
classpath 'com.google.gms:google-services:4.3.4'
**BUILD_SCRIPT_DEPS**}
}
allprojects {
repositories {
google()
jcenter()
flatDir {
dirs 'libs'
}
}
}
// Android Resolver Repos Start
([rootProject] + (rootProject.subprojects as List)).each {
ext {
it.setProperty("android.useAndroidX", true)
it.setProperty("android.enableJetifier", true)
}
}
([rootProject] + (rootProject.subprojects as List)).each { project ->
project.repositories {
def unityProjectPath = $/file:///**DIR_UNITYPROJECT**/$.replace("\\", "/")
maven {
url "https://maven.google.com"
}
maven {
url "https://deltadna.bintray.com/android" // Assets/DeltaDNA/Editor/Android/Dependencies.xml:8
}
maven {
url (unityProjectPath + "/Assets/GeneratedLocalRepo/Firebase/m2repository") // Assets/Firebase/Editor/AnalyticsDependencies.xml:18, Assets/Firebase/Editor/AppDependencies.xml:22
}
mavenLocal()
jcenter()
mavenCentral()
}
}
// Android Resolver Repos End
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
**APPLY_PLUGINS**
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
// Android Resolver Dependencies Start
implementation 'com.android.support:appcompat-v7:25.3.1' // Facebook.Unity.Editor.AndroidSupportLibraryResolver.addSupportLibraryDependency
implementation 'com.android.support:cardview-v7:25.3.1' // Facebook.Unity.Editor.AndroidSupportLibraryResolver.addSupportLibraryDependency
implementation 'com.android.support:customtabs:25.3.1' // Facebook.Unity.Editor.AndroidSupportLibraryResolver.addSupportLibraryDependency
implementation 'com.android.support:support-v4:25.3.1' // Facebook.Unity.Editor.AndroidSupportLibraryResolver.addSupportLibraryDependency
implementation 'com.deltadna.android:deltadna-sdk-notifications:4.10.0' // Assets/DeltaDNA/Editor/Android/Dependencies.xml:8
implementation ('com.facebook.android:facebook-applinks:[5,6)') {
exclude group: 'com.google.zxing'
}// Assets/FacebookSDK/Plugins/Editor/Dependencies.xml:6
implementation ('com.facebook.android:facebook-core:[5,6)') {
exclude group: 'com.google.zxing'
}// Assets/FacebookSDK/Plugins/Editor/Dependencies.xml:5
implementation ('com.facebook.android:facebook-login:[5,6)') {
exclude group: 'com.google.zxing'
} // Assets/FacebookSDK/Plugins/Editor/Dependencies.xml:7
implementation ('com.facebook.android:facebook-share:[5,6)') {
exclude group: 'com.google.zxing'
} // Assets/FacebookSDK/Plugins/Editor/Dependencies.xml:8
implementation 'com.google.android.gms:play-services-base:17.4.0' // Assets/Firebase/Editor/AppDependencies.xml:17
implementation 'com.google.firebase:firebase-analytics:17.6.0' // Assets/Firebase/Editor/AppDependencies.xml:15
implementation 'com.google.firebase:firebase-analytics-unity:6.16.0' // Assets/Firebase/Editor/AnalyticsDependencies.xml:18
implementation 'com.google.firebase:firebase-app-unity:6.16.0' // Assets/Firebase/Editor/AppDependencies.xml:22
implementation 'com.google.firebase:firebase-common:19.3.1' // Assets/Firebase/Editor/AppDependencies.xml:13
implementation 'com.parse.bolts:bolts-android:1.4.0' // Assets/FacebookSDK/Plugins/Editor/Dependencies.xml:4
// Android Resolver Dependencies End
// ** revenuecat **
implementation ('com.revenuecat.purchases:purchases-hybrid-common:1.2.0') {
exclude group: 'com.android.billingclient', module: 'billing'
}
implementation 'com.android.support:multidex:1.0.3'
**DEPS**}
// Android Resolver Exclusions Start
android {
packagingOptions {
exclude ('/lib/armeabi/*' + '*')
exclude ('/lib/mips/*' + '*')
exclude ('/lib/mips64/*' + '*')
exclude ('/lib/x86/*' + '*')
exclude ('/lib/x86_64/*' + '*')
}
}
// Android Resolver Exclusions End
android {
compileSdkVersion **APIVERSION**
buildToolsVersion '**BUILDTOOLS**'
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
defaultConfig {
minSdkVersion **MINSDKVERSION**
targetSdkVersion **TARGETSDKVERSION**
multiDexEnabled true
applicationId '**APPLICATIONID**'
ndk {
abiFilters **ABIFILTERS**
}
versionCode **VERSIONCODE**
versionName '**VERSIONNAME**'
}
lintOptions {
abortOnError false
}
aaptOptions {
noCompress = ['.unity3d', '.ress', '.resource', '.obb'**STREAMING_ASSETS**]
ignoreAssetsPattern = "!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~"
}**SIGN**
buildTypes {
debug {
minifyEnabled **MINIFY_DEBUG**
useProguard **PROGUARD_DEBUG**
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-unity.txt'**USER_PROGUARD****SIGNCONFIG**
jniDebuggable true
}
release {
minifyEnabled **MINIFY_RELEASE**
useProguard **PROGUARD_RELEASE**
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-unity.txt'**USER_PROGUARD****SIGNCONFIG**
}
}**PACKAGING_OPTIONS****SPLITS**
**BUILT_APK_LOCATION**
**EXTERNAL_SOURCES**
bundle {
language {
enableSplit = false
}
density {
enableSplit = false
}
abi {
enableSplit = true
}
}
}**SPLITS_VERSION_CODE****REPOSITORIES****SOURCE_BUILD_SETUP**
I saw several threads that said i should remove apply plugin: 'com.google.gms.google-services'
or to update classpath 'com.android.tools.build:gradle:3.4.0' to classpath 'com.android.tools.build:gradle:4.0.0' but that didn't do it for me and only caused more problems.
Also running ./gradlew :dependencies didn't show anything.
It's difficult to exactly say what's happening, but I have a few suggestions that should work.
First, get rid of classpath 'com.google.gms:google-services:4.3.4' under dependencies and apply plugin: 'com.google.gms.google-services'. The reason is that the purpose of this is to read a google-services.json file in your project directory and generate a res/values/google-services.xml file (more information here). The Firebase SDK for Unity will do this automatically placing this file under Assets/Plugins/FirebaseApp.androidlib/res/values/google-services.xml. Anything in a Plugins/*.androidlib file is now automatically pulled into the Android project, rendering this step redundant (and often causing errors both on the Unity and Android side).
Since you've used Unity to generate a mainTemplate.gradle file and you're using a newer version of Unity (2019.3 and above), you'll also need to generate a gradleTemplate.properties file. This way we can enable AndroidX (the replacement for the Android Support libraries now used by Firebase) and enable Jetifier (which will upgrade Google Support dependencies that it looks like Facebook is pulling in).
From here, since you mentioned disabling the External Dependency Manager for Unity (EDM4U), you will want to force resolve your Android dependencies.
You will want to have "Patch mainTemplate.gradle", "Use Jetifier.", and "Patch gradleTemplate.properties" all checked in your Android Resolver Settings for this to work:
If you're running into issues or you don't want to run EDM4U, I'm trying to do is add android.useAndroidX=true and android.enableJetifier=true to gradleTemplate.properties. For my own game, this file now looks like:
org.gradle.jvmargs=-Xmx**JVM_HEAP_SIZE**M
org.gradle.parallel=true
android.enableR8=**MINIFY_WITH_R_EIGHT**
**ADDITIONAL_PROPERTIES**
android.useAndroidX=true
android.enableJetifier=true
To recap, at this point you should have removed the play services plugin and enabled AndroidX and Jetifier support. You should be able to either build from Unity or export a gradle project and build from the command line (this latter is always a challenge in Unity since they opt to not use gradlew, so you may run into incompatibility with your system gradle).
If this doesn't help, I'd like to see a more complete error log to try to suss out the actual cause.
In your root-level (project-level) Gradle file (build.gradle), add rules to include the Google Services Gradle plugin. Check that you have Google's Maven repository, as well.
dependencies {
classpath 'com.google.gms:google-services:3.0.0'
classpath 'com.android.tools.build:gradle:3.3.1'
}
And then:
In your module (app-level) Gradle file (usually app/build.gradle), apply the Google Services Gradle plugin:
apply plugin: 'com.google.gms.google-services'
I had issue with combo Firebase+Unity+gradle. Solved by downgrading gradle.
Unity -> Edit -> Preference -> Gradle to version 6.7.1
It seems that Firebase could not work with newer gradle versions.
Download: Gradle
I got this error every time I try to run my android game:
Program type already present: android.support.v4.app.BackStackRecord$Op
Message{kind=ERROR, text=Program type already present: android.support.v4.app.BackStackRecord$Op, sources=[Unknown source file], tool name=Optional.of(D8)}
this is my build.gradle (app)
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
buildToolsVersion "27.0.3"
defaultConfig {
applicationId "com.play.flyaway"
minSdkVersion 21
targetSdkVersion 27
ndk {
moduleName "player_shared"
}
}
sourceSets {
main {
jni.srcDirs = []
}
}
buildTypes{}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
implementation 'com.google.android.gms:play-services:12.0.1'
implementation files('libs/dagger-1.2.2.jar')
implementation files('libs/javax.inject-1.jar')
implementation files('libs/nineoldandroids-2.4.0.jar')
implementation files('libs/support-v4-19.0.1.jar')
}
build.gradle (Project)
// 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.1.1'
}
}
allprojects {
repositories {
jcenter()
google()
}
}
Any solution to this problem? I already try everything I know of course, but I'm new on this, I really don't know what cause the error apart from what the console says
You need to remove the following dependency:
implementation files('libs/support-v4-19.0.1.jar')
and also remove the jar from libs directory. Then use the matching support library of your compileSdkVersion. So, change the above dependency with:
implementation 'com.android.support:support-v4:27.1.1'
This is related with Google play service dependency:
SDK Version Support in 11.2
When you upgrade your app’s Play services dependencies to 11.2.0 or
later, your app’s build.gradle must also be updated to specify a
compileSdkVersion of at least 26 (Android O). This does not change the
way your app runs. You will not be required to update
targetSdkVersion.
It's about duplicated support library used :
This dependency:
implementation files('libs/nineoldandroids-2.4.0.jar')
is using old version of support library. Try excluding the support library with:
implementation files('libs/nineoldandroids-2.4.0.jar'){
exclude group: 'com.android.support'
exclude module: 'appcompat-v7'
exclude module: 'support-v4'
}
This Problem is caused due to the versions of the support file and plays service. Update the play service dependencies as per the recommendations(Latest) and sync the project.
compile 'com.google.android.gms:play-services:12.0.1'
I have used only support:AppCompat, so having this problem
Solved this using implementation 'com.android.support:design:____'
implementation 'com.android.support:support-v4:____' along with AppCompat
In my case the problem was I already had the jar present in lib/ folder. Deleting it resolved the problem.
So check if you have jar present in any folder:
find . -name *.jar
If present in lib folder try deleting it
I have used this guide to build persistence with Room in my Android App:
https://developer.android.com/training/data-storage/room/index.html
and added dependances like shown here:
https://developer.android.com/topic/libraries/architecture/adding-components.html
when i build the debug version and deply to phone, everithing works fine.
When i build the release signed APK i got this error message:
Error:Error: json defines classes that conflict with classes now provided by Android. Solutions include finding newer versions or alternative libraries that don't have the same problem (for example, for httpclient use HttpUrlConnection or okhttp instead), or repackaging the library using something like jarjar. [DuplicatePlatformClasses]
my app.gradle:
apply plugin: 'com.android.application'
android {
signingConfigs {
/* TODO(developer): Configure to sign app with a release key for testing.
release {
storeFile file('path/to/release/signing/key')
keyAlias 'release_key_alias'
keyPassword "${password}"
storePassword "${password}"
}*/
}
compileSdkVersion 26
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "myappid"
minSdkVersion 14
targetSdkVersion 23
versionCode 10
versionName "1.8"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
// TODO(developer): uncomment below once config above is complete and uncommented.
//signingConfig signingConfigs.release
}
}
}
configurations {
all {
exclude module: 'httpclient'
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:26.1.0'
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.volley:volley:1.0.0'
compile 'com.github.nkzawa:socket.io-client:0.3.0'
compile 'io.socket:socket.io-client:0.8.3'
compile 'com.android.support:design:26.1.0'
compile 'android.arch.persistence.room:runtime:1.0.0'
implementation "android.arch.persistence.room:runtime:1.0.0"
annotationProcessor "android.arch.persistence.room:compiler:1.0.0"
}
my project.gradle
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
//classpath 'io.socket:socket.io-client:0.8.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
ext{
roomVersion = '1.0.0'
}
allprojects {
repositories {
google()
jcenter()
maven { url 'https://maven.google.com' }
}
}
Somebody can help or give me clues?
I finally found the problem was a JSON sub-module:
compile 'com.github.nkzawa:socket.io-client:0.3.0'
this library has a submodule:
org.json:json
that is now conflicting with android native module, because in my other dependancies i can't find this one. It was working fine 10 days ago.
I also had to kill this:
compile 'io.socket:socket.io-client:0.8.3'
the final solution was to add an exclude for the module and change the line like this:
implementation ('com.github.nkzawa:socket.io-client:0.3.0',{
exclude group:'org.json', module:'json'
})
I also have noticed AFTER i solved the problem that in the error log it was suggesting me the module that was in conflict but even if i read it a hundred times i didn't noticed before:
so maybe google or Intellij could improve the writing of this errors...
To spot this class duplicate conflict error module i found the best way to proceed is to create a new project and paste in the dependancies in app build.gradle, and check them one by one or with "dividi et impera", maybe this is an obvious suggestion for someone but i would have like to have it sooner.
I had the same problem and I searched for the conflict via the gradle dependency tree:
gradlew app:dependencies
Then I excluded the the json module for the conflicting library:
implementation ('<conflicting-library>',{
exclude group:'org.json', module:'json'
})
How to find the duplicate library.
open gradle run window and run such command:
gradle module-name:dependencies
the "module-name" should be your app module's name, for me, it's "osmunda-demo".
then use Ctrl+F to search "commons-logging", you'll find it.
#Romeo has suggested a really great point. Was unable to debug the code for hours. The problem lies within the dependencies that are imported in build.gradle. It may be your own custom sdk/artifact. I had issues with my own library which uses jjwt. I added the exclusion in my sdk but you will have to add it again whenever using the sdk. Make sure to add exclude group: 'org.json', module: 'json' in your artifact implementation.
I encountered a problem with the Firebase integration. First of all, I have added rules to the root-level build.gradle file:
buildscript {
repositories {
maven { url "http://dl.bintray.com/populov/maven" }
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.2'
classpath 'com.google.gms:google-services:3.0.0'
}
}
allprojects {
repositories {
maven { url "http://dl.bintray.com/populov/maven" }
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
And the module Gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "24"
defaultConfig {
applicationId "com.example.app"
minSdkVersion 14
targetSdkVersion 24
versionCode 2
versionName "0.9"
}
buildTypes {
///
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.google.firebase:firebase-core:9.0.2'
compile 'com.google.firebase:firebase-crash:9.0.2'
}
apply plugin: 'com.google.gms.google-services'
During the build of the project, I get the error:
Error:Error converting bytecode to dex: Cause:
com.android.dex.DexException: Multiple dex files define
Lcom/google/firebase/FirebaseException;
Error reason is clear, but I didn't compile any library twice. Should I exclude FirebaseException class from the build process manually? If so, how? Perhaps this is a bug within the Firebase dependencies?
Thanks.
I had this problem with react-native-google-signin module. As the instructions how to modify build.gradle are often not up to date, incomplete or just defined in multiple unrelated projects the project compiled only after copying the settings from the react-native-google-signin example project. It turns out the order of statements is important as well as exclude group command. The final result looked like this (in app/build.gradle):
dependencies {
...
compile 'com.google.android.gms:play-services-auth:9.2.1'
compile(project(":react-native-google-signin")) {
exclude group: "com.google.android.gms"
}
}
task copyDownloadableDepsToLibs(type: Copy) {
from configurations.compile
into 'libs'
}
apply plugin: 'com.google.gms.google-services'
The top build.gradle included an additional gms classpath as usual:
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.2'
classpath 'com.google.gms:google-services:3.0.0'
}
}
After these changes build finished without any Multiple dex errors.
FireBase is a huge library, so you need to enable multidex support in your application.
dependencies {
compile ('com.google.firebase:firebase-core:9.0.2') {
exclude module: 'play-services-base'
exclude module: 'support-v4'
exclude module: 'support-annotations'
}
compile 'com.android.support:multidex:1.0.1'
}
defaultConfig {
// Enabling multidex support.
multiDexEnabled true
}
Looks like you have reached methods count limit. Try to remove firebase dependencies and check methods count for your app (for example, with this gradle plugin (if you don't remove these dependencies you won't be able to build your project at all, thus, to use the methods count plugin).
Firebase is a HUGE library - 17k+ methods. It depends on tons of stuff. One thing you can do is to check dependencies list by clicking this button on "methodscount.com":
If you already have some of these in your project you can try to exclude them:
compile ('com.google.firebase:firebase-core:9.0.2') {
exclude module: 'play-services-base'
exclude module: 'support-v4'
exclude module: 'support-annotations'
}
If this doesn't help then you might want to configure multidex for you project.
I am using react-native-maps and react-native-google-signin.
And, I got Multiple dex files define Lcom/google/firebase/FirebaseException
Bellow my solution.
Open build.gradle (react-native-maps)
dependencies {
provided "com.facebook.react:react-native:+"
compile "com.google.android.gms:play-services-base:10.2.4"
compile "com.google.android.gms:play-services-maps:10.2.4"
}
The version is 10.2.4
Continue open build.gradle (react-native-google-signin)
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile "com.android.support:appcompat-v7:23.0.1"
compile 'com.google.android.gms:play-services-auth:9.2.1' <- change here
compile "com.facebook.react:react-native:+"
}
It uses version 9.2.1, and this is reason.
Change it to version 10.2.4 will be
compile 'com.google.android.gms:play-services-auth:10.2.4'
Next, open build.gradle (app) and add a new one
compile 'com.google.android.gms:play-services-auth:10.2.4'
Now you have.
compile 'com.google.android.gms:play-services-auth:10.2.4'
compile(project(":react-native-google-signin")){
exclude group: "com.google.android.gms"
}
Run command cd android & gradlew clean & cd .. util no error then run react-native run-android.
Hope can help.
In case it helps anyone, I was hitting a similar problem, it was caused by the Gradle plugin for Google services bringing in a dependency which conflicted with Firebase.
In my top level build.gradle I had, in buildscript:
classpath 'com.google.gms:google-services:3.0.0'
Which was bringing in (automatically) dependencies which were conflicting with, in my app's build.gradle:
compile 'com.firebaseui:firebase-ui-auth:2.2.0'
Little bit confusing as I only had one compile dependency and was scratching my head what could be conflicing.
I removed the google-services gradle plugin and it solved the issue. I suppose I could also just find the right version :)
I encountered this error when I was using firebase-ui:2.0.0. I managed to solve it by downgrading to 'com.firebaseui:firebase-ui:1.2.0' and added the following line in Project level build.gradle:
allprojects {
repositories {
jcenter()
// Add the following
maven {
url 'https://maven.fabric.io/public'
}
}
}
Thanks to this post, just check and upgrade your google dependencies versions to the last release.
I could fix my problem. The problem was that BaseGameUtils was still
using/referencing an older version of play-services. Added the correct
version, and it works now. Guess I will omit BaseGameUtils for my next
project.
This is because some of your libraries use different versions of other library.
Check out your last added library and exclude.
For my project that was 'react-native-firestack'.
compile(project(':react-native-firestack')){
exclude group: "com.google.android.gms" // very important
}
Please add this code inside android in build.gradle
dexOptions {
preDexLibraries = false
}
I am relatively new to Android development and VERY new to Android Studio (much more experienced with Eclipse + android plugin). I am trying to edit a github project, but I can't seem to get it to even compile! I have been reading up, and my error seems to have to do with the build.gradle/locations of libraries themselves.
My error is:
Error:Configuration with name 'default' not found.
It also says "Gradle project sync failed, but I think its related to the above error…whatever that means.
My outer build.gradle is:
// Top-level build file where you can add configuration options common to all sub- projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.12.+'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
And my inner build.gradle file is:
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 20
buildToolsVersion '20.0.0'
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
}
defaultConfig {
applicationId "com.wisely.loyalty"
minSdkVersion 14
targetSdkVersion 18
versionCode 17
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(':facebook')
compile project(':cwac')
// You must install or update the Support Repository through the SDK manager to use this dependency.
// You must install or update the Support Repository through the SDK manager to use this dependency.
// You must install or update the Support Repository through the SDK manager to use this dependency.
// You must install or update the Support Repository through the SDK manager to use this dependency.
// You must install or update the Support Repository through the SDK manager to use this dependency.
compile group: 'org.apache.httpcomponents' , name: 'httpclient-android' , version: '4.3.5'
compile('org.apache.httpcomponents:httpmime:4.3.5') {
exclude module: "httpclient"
}
compile 'com.android.support:support-v13:20.0.0'
compile 'com.google.android.gms:play-services:5.0.+'
compile 'com.android.support:appcompat-v7:20.0.0'
compile 'com.android.support:support-v4:20.0.0'
compile 'com.google.code.gson:gson:2.2.4'
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.2'
compile 'com.makeramen:roundedimageview:1.3.0'
compile 'com.crashlytics.android:crashlytics:1.+'
}
EDIT:
General file hierarchy
root
.idea
app
libs
cwac
fb
utils
src
… all source files
gradle
build.gradle
settings.gradle
External Libraries
Android API 20 Platform
JDK
EDIT: Settings.gradle:
include ':app', ':facebook', ':cwac', ':utils'
project(':facebook').projectDir = new File('app/libs/facebook')
project(':cwac').projectDir = new File('app/libs/cwac')
project(':utils').projectDir = new File('app/libs/utils')
Progress Update:
I've tried moving the library files around in the directory to no avail. I also tried using my eclipse environment which just seemed to have even more issues. I really need to get this project configured properly!
UPDATE #2:
I have a strong feeling that this has to do with the gradle version since the file configuration seems fine, and its likely my computer that is lacking something. I am new to using gradle. Is there a way to update it? Or is it simply updated through the support libraries in the sdk manager?
Add your library folder in your root location of your project and copy all the library files there. For ex YourProject/library then sync it