I carefully followed the steps that were listed here:
http://overlap2d.com/making-physics-based-side-scroller-project-setup-part-1/
include 'desktop', 'core', 'Overlap2dRuntime'
project(':Overlap2dRuntime').projectDir = new File(settingsDir, '../overlap2d-runtime-libgdx-master')
and this:
project(":core") {
apply plugin: "java"
dependencies {
compile "com.badlogicgames.gdx:gdx:$gdxVersion"
compile "com.badlogicgames.gdx:gdx-box2d:$gdxVersion"
compile "com.badlogicgames.gdx:gdx-freetype:$gdxVersion"
compile "com.badlogicgames.box2dlights:box2dlights:1.2"
compile project(":Overlap2dRuntime")
}
}
After syncing gradle, I got BUILD SUCCESSFUL.
My folder: overlap2d-runtime-libgdx-master is located in the same parent directory as my folder for my project.
However, when I try to access Overlap2DStage, Android Studio tells me that it cannot find the symbol Overlap2DStage! I can't import any of the classes that I've set the dependency for!
Okay, the key to this issue is removing the other Settings.gradle file in the library!
Check out this link: https://code.google.com/p/android/issues/detail?id=65915
Related
i have created an android library AAR in android studio 2.1.3 in which i use the following dependencies:
compile 'com.google.android.gms:play-services-vision:9.4.0+'
compile 'com.google.android.gms:play-services-wearable:9.4.0+'
compile 'pl.droidsonroids.gif:android-gif-drawable:1.2.3'
now i am using this aar in an application but those dependencies were failing unless i add them to the dependencies of the new app.
i search here and i found that i need to add the following line:
compile (project(':LIBNAME-release')) {transitive = true}
but this didn't work. is there something i missed? or is it related to the obfuscation i did to the aar file? or is it a must to add these dependencies to the app?
Try to compile you project first:
dependencies {
compile project(':Name-Of-Your-Project')
}
This is Ashton Engberg's suggestion from that post
Trying to build Google Maps Android API utility library, I have SDK 23 installed and all the right SDK tools. At first when i imported the project I wasn't able to run it, the run button was greyed out. I then added "apply plugin: 'com.android.application'" to the top of gradle file. Then when i try to compile, I get the Failed to resolve: com.google.maps.android:android-maps-utils:0.4+ error in my build gradle(module: library).
dependencies {
compile 'com.google.android.gms:play-services-maps:8.4.0'
compile 'com.google.maps.android:android-maps-utils:0.4+'
}
dependencies section in original android-maps-utils-master/demo/build.gradle contains:
dependencies {
compile project(':library')
// Or, fetch from Maven:
// compile 'com.google.maps.android:android-maps-utils:0.3+'
compile 'com.google.android.gms:play-services-maps:8.4.0'
}
So:
You may use it as it is. Library android-maps-utils will be compiled from "compile project(':library')". It works for me. Or
You may comment "compile project(':library')", then uncomment "compile 'com.google.maps.android:android-maps-utils:0.3+'" and the library will be downloaded from maven repository. But )
Gradle has no idea where it is. So you should add the followilg code:
allprojects {
repositories {
mavenCentral()
}
}
into the file android-maps-utils-master/build.gradle
This actually works:
Comment out the other dependencies where any google Api is called.
Specifically, firebase ( compile 'com.google.firebase:firebase-ads:9.0.1' ) and gms( compile 'com.google.android.gms:play-services-maps:9.0.1' ).
Now go for 'Sync Now'.
You may encounter some other error, like some value is missing.
Ignore the errors, uncomment the commented dependencies and Voila! It all has been figured out by our dear Gradle!
I downloaded this library to use in my app, however, I can't get Android Studio to do the gradle build now. Anytime I try, I get "error:configuration with name 'default' not found". I've tried several other StackOverflow answers, but I still can't compile.
My dependencies (from build.gradle Module: app)
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.1.1'
compile 'com.android.support:support-v4:22.1.1'
compile project(":aFileDialog")
}
My settings.gradle:
include ':app'
include ':aFileDialog'
I have the library file in the root under "aFileDialog"
How can I get this to build with the library?
You have add path to your aFileDialog library in your settings.gradle
Make sure that folder you point to includes build.gradle file
include ':app'
include ':aFileDialog'
project(':aFileDialog').projectDir = new File(settingsDir, 'aFileDialog')
or (judging from the library folder structure on GitHub)
project(':aFileDialog').projectDir = new File(settingsDir, 'aFileDialog/library')
I found a tutorial that worked: http://www.theappguruz.com/tutorial/library-project-module-as-dependency-in-android-studio/
In addition to the instructions given, I had to add the following line to my Manifest:
tools:replace = "icon, label"
I'm trying to setup nhaarman/ListViewAnimations inside of Android Studio 1.1.0.
From Setup:
Add the following to your build.gradle:
repositories {
mavenCentral()
}
dependencies {
compile 'com.nhaarman.listviewanimations:lib-core:3.1.0#aar'
compile 'com.nhaarman.listviewanimations:lib-manipulation:3.1.0#aar'
compile 'com.nhaarman.listviewanimations:lib-core-slh:3.1.0#aar'
}
yet Android Studio says:
Gradle project sync failed. Basic functionality (e.g. editing,
debugging) will not work properly.
Error:(26, 0) Gradle DSL method not found: 'compile()'
Possible causes:<ul><li>The project 'X' may be using a version of Gradle that does not contain the method.
Gradle settings</li><li>The build file may be missing a Gradle plugin.
Apply Gradle plugin</li>
You are adding these dependencies in the top level build.gradle file.
You have to add these lines in the module build.gradle file.
root
build.gradle //top level
app
build.gradle //module level
After adding those lines to:
build.gradle (Module: app)
instead of
build.gradle (Project: app)
the error is gone.
Try this:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.nhaarman.listviewanimations:lib-core:3.1.0'
compile 'com.nhaarman.listviewanimations:lib-manipulation:3.1.0'
}
Try removing #arr. worked for me.
//ListView Animations
compile 'com.nhaarman.listviewanimations:lib-core:3.1.0'
compile 'com.nhaarman.listviewanimations:lib-manipulation:3.1.0'
I Added a External Library to my project by following
this method. and tried this method too this method too.
Gradle build got Finished and i got this line added to my build.gradle
compile 'com.github.castorflex.smoothprogressbar:library-circular:1.0.1'
Now i am trying to import this library in my class. But i can't do this. I took a look at the files and they are located in the build directory under the exploded-aar. so i added #aar to the compile line. Still there are no changes.
How can i import this library to my class or where i am going wrong?
Thanks in Advance
Well, you don't need to download anything or point your dependency to a file.
This dependency, as most of the dependencies you use, can automatically fetched from JCenter, biggest repository for Java and Android components.
All you need to do is:
Add JCenter as your dependencies repository.
Declare that you need the library-circular dependency. This can be found and copy/pasted from the file icon in particular package/version in JCenter.
Resync your Android Studio project with your Gradle build file. This is the 'sync' button in Gradle pane in Android Studio.
Here's what your build.gradle should include:
repositories {
jcenter()
}
dependencies {
compile(group: 'com.github.castorflex.smoothprogressbar', name: 'library-circular', version: '1.0.1', ext: 'aar')
}
in build. gradle put following code
dependencies {
compile fileTree (dir: 'libs', include: ['*.jar'])
}
Did you add the dependencies?
You can do so in the following way -
dependencies {
compile files('insert ParentFolder/external_library_name with the extension here')
}
Add it to build.gradle based in the app folder
1.Put the jar file into the libs folder.
2.Right click it and hit 'Add as library'.
3.Ensure that compile files('libs/abcdef.jar') is in your build.gradle file and Finally add the dependencies.
Eg.
dependencies {
compile fileTree(dir: '../jar', include: '*.jar')
compile project(':pull-to-refresh')
compile files('libraries/abcdef.jar')
}
Hope this helps :)