Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to import a backend module class into an app module in android studio

In my android project, i have two modules,

  • App module

  • backend module

I want to import a backend module class into one of my app module class. but when i try to import it like this

import com.me.you.backend.entities

i get an error Error:(52, 58) error: package com.me.you.backend.entities does not exist

The next thing that i tried is to compile my backend module in my app's build.gradle like this

dependencies {
....
compile project(':backend')
}

But i get 13 warnings! of this type

WARNING: Dependency org.apache.httpcomponents:httpclient:4.4.1 is ignored 
for debug as it may be conflicting with the internal version provided by Android.

In case of problem, please repackage it with jarjar to change the class packages 

And when i run my app module, i get this error

 Error:Execution failed for task ':app:packageAllDebugClassesForMultiDex'.

java.util.zip.ZipException: duplicate entry: com/google/appengine/repackaged/com/google/api/client/auth/oauth2/AuthorizationCodeFlow$Builder.class

Question

How can i successfully import my backend class?

like image 642
Edijae Crusar Avatar asked Nov 10 '22 03:11

Edijae Crusar


1 Answers

Solution was to add dependancy on backend module in my app module's build.gradle like this

compile project(path: `:backend`, configuration: `android-endpoints`)

After this i rebuild my project (Build > Rebuild project). and everything was ok.

like image 175
Edijae Crusar Avatar answered Nov 14 '22 22:11

Edijae Crusar