There are several existing questions on this, but none of the solutions seem to work for me.
I want to white label my app. The first step is to go to the project's properties and mark the project a Library Project.
Then, create a new Android Application Project, open properties, and add your Library Project to the Library section of the Android tab.
When I try to compile, I get the error:
Unable to execute dex: Multiple dex files define Lcom/facebook/android/R$drawable;
My app uses the Facebook library (not in the form of a jar). The attached screenshot shows what my workspace looks like. com_facebook_android, and another library called wheel, are not in my top project's (library project) libs folder, but they are added as libraries in properties. I think I tried to move them there once and ran into a whole bunch of problems. The app is functioning fine without them in there so I left it. I'm not sure if this is the problem or not.
Could someone point me in the right direction? Despite the existing questions on stackoverflow, I haven't been able to figure out how to make this work.
UPDATE:
I've almost solved the problem. I went about adding my Library Project to WhitelabelTest a different way.
I had originally gone to WhitelabelTest > Properties > Android > Library > and added my Library Project to the list. I removed this.
Instead, I went into the bin folder for my Library Project, copied the jar file (we'll call it LibraryProject.jar) and pasted it into the /libs folder of WhitelabelTest. I then right clicked LibraryProject.jar > Build Path > Add to Build Path.
This allowed me to compile the WhitelabelTest project and have it install onto my emulator.
However, when the application launched, I received the following crash:
FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to instantiate application com.example.whitelabeltest.WhitelabelTest: java.lang.ClassNotFoundException: com.example.whitelabeltest.WhitelabelTest in loader dalvik.system.PathClassLoader[/system/framework/com.google.android.maps.jar:/data/app/com.example.whitelabeltest-1.apk]
at android.app.LoadedApk.makeApplication(LoadedApk.java:466)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:3260)
at android.app.ActivityThread.access$2200(ActivityThread.java:117)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:969)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:130)
at android.app.ActivityThread.main(ActivityThread.java:3683)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: com.example.whitelabeltest.WhitelabelTest in loader dalvik.system.PathClassLoader[/system/framework/com.google.android.maps.jar:/data/app/com.example.whitelabeltest-1.apk]
at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at android.app.Instrumentation.newApplication(Instrumentation.java:942)
at android.app.LoadedApk.makeApplication(LoadedApk.java:461)
... 11 more
Perhaps this is because my /src folder in WhitelabelTest is completely empty? I've added no new source code to WhitelabelTest. I'm purely attempting to import my Library Project into a new Android Application Project so I can share the code and just update a few drawables in /res.