Reputation: 55
I have my Android Studio project structured as follow:
/mysdk
-manifests
-java
-com.xxx.sdk
-ext-libs
-com.yyy.lib (not .jar but .java files instead)
-res
/app
-manifests
-java
-res
I can include com.yyy.lib.* inisde com.xxx.sdk and reference all the methods without any symbol resolution problem in Eclipse project.
But after I transfer my IDE from Eclipse to Android Studio and it tells me it cannot resolve the symbols/methods from com.yyy.lib inside com.xx.sdk (ex: com.xxx.sdk.Activty.java)
How can I fix this dependency problem in Android studio?
Upvotes: 1
Views: 806
Reputation: 2423
If you have no strong preference for the location of com.yyy.lib
, just moving it into the parent (is it src/main/java
? based on gradle convention) it will probably get picked up.
It appears the IDE is treating src/main/java
(or whatever) as a source folder and your package paths aren't matching up with your directory structure
ext-libs.com.yyy.lib
instead of com.yyy.lib
Upvotes: 1
Reputation: 375
In your project file browser:
Go to libs folder. and add your library if not present
and then in gradle: add compile files('libs/your_library')
in dependencies and then Sync Gradle
Upvotes: 1
Reputation: 923
That's because Android Studio uses Gradle as its dependency manager, whereas Eclipse uses either Maven or Ant.
You can read more about managing dependencies with Gradle, here.
This answer explains how to add a dependency/library to Gradle in Android Studio.
Upvotes: 1