I would like to start a project in Android Studio, using Simple Facebook library.
I used to develop in Eclipse and things were fine, but now i had to face an issue while trying to make the libraries work with gradle.
I made a new project.
I made a module for official Facebook SDK inside "libraries" folder
I made a module for Simple Facebook library inside "libraries" folder
I got the following error:
Error:A problem occurred configuring project ':app'.
> Cannot evaluate module simplefacebook : Configuration with name 'default' not found.
I did my research and as everybody experienced this error message is not really informative, and i also tryed to solve this problem from stack overflow's other smiliar questions but just coudnt get it work.
Please help if you can.
And please mention in comment which gradle file you would like to see, because there are 5 of them.
Look in the docs from Facebook!
You don't need to place the hole project as library module anymore in android studio.
Facebook and many other API Providers provide ther Libs now over Maven and you only have to add the dependcy to the correct artifact in your apps build.gradle file.
Here example for Facebook SDK:
dependencies {
compile 'com.facebook.android:facebook-android-sdk:4.1.0'
}
Copied from here: https://developers.facebook.com/docs/android/getting-started
I havn't searched for the other lib, but you should find it your self on developers.facebook.com.
Related
I recently started developing my really first Android Project using Android Studio 3.1.2.
Therefore I implemented a module library into my app, by cloning it from github, imported it as module library and added a dependency via right-click on app > module settings, switch to dependency tab, hit the +, select imported_module.
Additionally I checked my build.gradle(Module:app), if the dependency has been added correctly, there this line appeared:
dependencies {
...
implementation project(':imported_module')
}
Also in the settings.gradle file it says:
include ':app', ':imported_module'
Now if I want to access features of imported_module any of them can't be resolved. I browsed the official and the common forums for hours to find the one step I obviously missed but wasn't smart enough to find the solution.
Synching the project with gradle files didn't cause any visible effects
What do I still have to do to be able to use all the fancy stuff fro imported_module inside my app? Do I have to import it in a certain way?
Or do I have to modify my AndroidManifest of my app somehow? Thanks in forward!
EDIT: could it be that my app and imported_module obviously have different package names? The Project File Tree says com.domain.example.my_app for the app and com.domain.example.imported_module for imported_module. Do I have to squeeze the one into the other?
It could have been much easier, if you had mentioned what exactly you want to access in main app. May be access specifier of the member in your imported_module is private.
I kinda worked around the whole thing, by just adding a remote dependency in my build.gradle file of a new project, pasted my java classes and my res into this new project, synched it and now it runs. Nevertheless thanks for thy help!
That should be really all. Be sure to sync your project with Gradle files (File - Sync Project with Gradle Files).
I'm currently new on Android. I try to create an app using another app project as an external library. For the moment, the two projects (two apps just created via Android Studio) are in the same folder like :
Project1
|--build.gradle
|--settings.gradle
Project2
|--build.gradle
|--settings.gradle
To add project2 as an external library, I just added to Project1/settings.gradle :
include ':MyDependency'
project(':MyDependency').projectDir = new File('D:/Projects/Project1', '../Project2')
and in the build.gradle of the application : compile project(':MyDependency').
Then, Project2 appears on the project window, so I guess it found the project.
When I then try to sync with gradle, I obtain the message
"Error:Unable to resolve dependency for ':app#debugAndroidTest/compileClasspath': Could not resolve project :MyDependency." and the same message for each other task in compileClassPath.
When I click on show details, the following message is displayed :
"Unable to find a matching configuration of project :MyDependency: None of the consumable configurations have attributes."
I tried each solution given for each problem, (buildTypes, clear caches, etc), but it does not work.
I also remarked that when I open Project2/app/src/main/AndroidManifest.xml, most attributes are not allowed here. Weird thing because if I open Project2 in another window on Android Studio, I don't get this message (and it builds perfectly). Once again, i tried each solution given on internet, which did not resolve my problem. I think that it's the cause of the problem.
Does anyone have an idea ?
I'm using Android Studio 3.0.1 and gradle 4.1.
Thank you very much!
Regards :)
You can change your Project2 to another module in Project1 as android library. In your project build.gradle you put include ':app', ':library-module' and in your app dependencies:
dependencies {
compile project(":library-module")
}
More info: https://developer.android.com/studio/projects/android-library.html
Dude you need to create a framwork that ‘ll share the code between your 2 apps
I just went through the GearVRf setup instructions (here), and trying to get the demo/sample applications to compile. The framework compiles fine, but when I open a project and build it, I get:
Unresolved dependencies
Error:Failed to resolve: :backend-debug:
This happens for any demo I choose,and is all the information I am given.
Also, the 'Android Support Repository' is installed, if that is your first guess.
Any suggestions on either getting more information about the problem, or how to fix it?
Thanks
Turns out the necessary dependency (backend-debug.arr) is in the GearVRf-Demos directory.
If you move the GearVRf-Demos directory INSIDE the "GearVRf" directory, everything magically works.
Giving you: "..\GearVRf\GearVRf-Demos\gearvrf-libs"
I'm trying to create an Android application in Android Studio. When I try to create the project, it tells me that the Gradle refresh failed, with the error message
Error:Cannot find JAR 'ivy-2.2.0.jar' required by module 'gradle-dependency-management' using classpath or distribution directory 'C:\Gradle\gradle-2.10'
What is ivy-2.2.0.jar, and how do I fix this?
As of 7/19/2017, I have seen that the ivy-2.2.0.jar file is included in both the binaries-only and the complete installations for Gradle.
The file is located here:
gradle-4.0.1\lib\plugins\ivy-2.2.0.jar
Ironically, I received the same issue when attempting to build one of Oculus's VR sample projects.
When switching to the complete installation, I no longer received this specific error.
Perhaps try switching to the complete installation, or migrating the project to use any Gradle Wrappers that might be available.
This might happen if you are using the complete distribution with sources of Gradle. Try out the binary only distribution. It should work.
I am currently developing an Android application and I'd like to use Graphhoper 0.3 embedded in the application (I have no way of setting up a server).
I am working with Android 4.0, Eclipse Kepler, Maven 3.2.1, Android for Maven Eclipse 1.0.1.
I first tried to pull branch 0.3 and set the "core" folder up as an Eclipse project, then adding it in the Build Path of my android project. I also tried to use the graphhopper-0.3-android.jar directly.
Android Project Main Activity onStart():
GraphHopper hopper = new GraphHopper().forMobile();
Unfortunately, everytime I got the following error:
java.lang.NoClassDefFoundError: org.slf4j.LoggerFactory
It does not pop in a regular Java project; only in Android.
I've tried to add the slf4j JAR's to the build path, with no success.
Any help would be greatly appreciated! It's my first post here, and I really don't know what I could try more. If you need any more information on my setup or anything, please ask!
Edit
Complete solution in comments of the validated answer.
Because you are trying to use Graphhopper directly, the Maven is not downloading all the dependencies of the Graphhopper. In order to fix this, you should either add the Graphhopper as Maven dependency, or try to resolve the dependencies 'by hand' - i.e. by adding missing classes to the build path and exporting them to the APK (if you are using Maven, then simply add the dependencies to the pom.xml without scope tag).