Search code examples
javaandroidintellij-ideaandroid-simple-facebook

How to start an activity that is in a jar file?


I'm working on an android app which uses facebook sdk and the android-simple-facebook library (a "wrapper" library). The android-simple-facebook lib depends on facebook sdk and my app depends on android-simple-facebook.

I created a jar file (via Artificats in IDEA's Module Settings) containing the compile output of both libraries.
I need the facebook sdk compile output too because I have this reference to facebook's LoginActivity in my AndroidManifest.xml:

<activity
android:name="com.facebook.LoginActivity"
android:label="@string/app_name"
android:theme="@android:style/Theme.Translucent.NoTitleBar" />

The reason I created this jar file is that i'm not the only developer working on this project, and I don't want anyone who develops this project to reference 2 libraries. I just want them to work with a static jar I create.
So the jar get's created and everything is fine, no compile errors, but when calling the login() function, which starts facebook's LoginActivity I guess, I get the following exception:

Unable to resume activity {com.example.example/com.facebook.LoginActivity}: android.content.res.Resources$NotFoundException: Resource ID #0x7f02000a

What I suspect is, LoginActivity.onCreate() executes setContentView(R.layout.com_facebook_login_activity_layout) but I don't see any resources (the layout files for example) inside the jar file.

Any help on how to accomplish my goal of having one working jar will be greatly appreciated!


Some additional info about my setup:

  • My libs folder and jar's contents:
    libs and jar contens
  • Artificat settings:
    Artificat settings

Solution

  • What I ended up doing is adding the libraries (repositories) as sub-modules in git and as modules in my project. So, I don't know if the answer is really "No, it can't be done", but that's how I solved the problem for now.

    Hope it helps anyone.