Is it possible to create an Android plugin which includes a project reference?

When building an apk using the build.sh script, we can include a reference to another android project by adding a line like this to the project.properties file:

android.library.reference.1=/Applications/CoronaEnterprise/Corona/android/lib/Corona

Is it possible to do the same thing when building a plugin jar file, by adding the same line to project.plugin.properties? If so, would the referenced project be “built in” to the jar file, or would it still need to be included somewhere else if the plugin was made available for SDK use?

I’m going to be attempting this in the next day or so anyway and will update this post with my findings, but if someone knows the answer already that would be appreciated. 

It would be easy for me to think it works, only to find out that when downloaded through Corona SDK it doesn’t work for some reason.

I’ve just tried building a plugin jar, with the other project referenced in the project.plugin.properties file.  

Although it built without any errors, I don’t see any references to that other project in the jar file. And if I try to build a project that references my plugin, it fails because the plugin cannot find the code from the other android project.  

Is there a way around this?

Edit: Just a thought…is it possible to somehow build that other Android project into a jar file? That way my plugin just needs to include that rather than referencing another project.

Next update:

I tried building the other project into a jar by adding a custom_rules.xml file to it, with this inside:

\<target name="jar" depends="-compile"\> \<jar destfile="bin/theProj.jar" basedir="bin/classes" /\> \</target\>

That built ok, so I added that to the project with my own plugin jar file, but still no luck when it comes to building a new project which uses my plugin…

07-16 18:49:18.626: I/Corona(15573): android.content.ActivityNotFoundException: Unable to find explicit activity class {com.quiztix.mygame/com.sdkName.theClassName}; have you declared this activity in your AndroidManifest.xml? 07-16 18:49:18.626: I/Corona(15573): Java Stack Trace: 07-16 18:49:18.626: I/Corona(15573): android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1648) 07-16 18:49:18.626: I/Corona(15573): android.app.Instrumentation.execStartActivity(Instrumentation.java:1442) 07-16 18:49:18.626: I/Corona(15573): android.app.Activity.startActivityForResult(Activity.java:3511) 07-16 18:49:18.626: I/Corona(15573): android.app.Activity.startActivityForResult(Activity.java:3472) 07-16 18:49:18.626: I/Corona(15573): android.app.Activity.startActivity(Activity.java:3714) 07-16 18:49:18.626: I/Corona(15573): android.app.Activity.startActivity(Activity.java:3682) 07-16 18:49:18.626: I/Corona(15573): com.sdkName.theClassName(SDKNAME.java:748) 07-16 18:49:18.626: I/Corona(15573): com.sdkName.theClassName(SDKNAME.java:671) 07-16 18:49:18.626: I/Corona(15573): plugin.myPlugin.LuaLoader.myFunction(LuaLoader.java:243) 07-16 18:49:18.626: I/Corona(15573): plugin.myPlugin.LuaLoader$MyFunctionWrapper.invoke(LuaLoader.java:255) 07-16 18:49:18.626: I/Corona(15573): com.ansca.corona.JavaToNativeShim.nativeTouchEvent(Native Method) 07-16 18:49:18.626: I/Corona(15573): com.ansca.corona.JavaToNativeShim.touchEvent(Java

So I added the activity values from the original projects manifest file to my own manifest file (that was an oversight on my part I’ll admit).

Then I added any missing values from res/values which allowed it to build, but it still then crashes saying resources were missing.  

I’m beginning to think either:

a) there will be some really simple way to ‘attach’ the other android library project to my plugin

b) it will be impossible to get this plugin to work

I’m hoping that it won’t be the latter.

I’ve just tried building a plugin jar, with the other project referenced in the project.plugin.properties file.  

Although it built without any errors, I don’t see any references to that other project in the jar file. And if I try to build a project that references my plugin, it fails because the plugin cannot find the code from the other android project.  

Is there a way around this?

Edit: Just a thought…is it possible to somehow build that other Android project into a jar file? That way my plugin just needs to include that rather than referencing another project.

Next update:

I tried building the other project into a jar by adding a custom_rules.xml file to it, with this inside:

\<target name="jar" depends="-compile"\> \<jar destfile="bin/theProj.jar" basedir="bin/classes" /\> \</target\>

That built ok, so I added that to the project with my own plugin jar file, but still no luck when it comes to building a new project which uses my plugin…

07-16 18:49:18.626: I/Corona(15573): android.content.ActivityNotFoundException: Unable to find explicit activity class {com.quiztix.mygame/com.sdkName.theClassName}; have you declared this activity in your AndroidManifest.xml? 07-16 18:49:18.626: I/Corona(15573): Java Stack Trace: 07-16 18:49:18.626: I/Corona(15573): android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1648) 07-16 18:49:18.626: I/Corona(15573): android.app.Instrumentation.execStartActivity(Instrumentation.java:1442) 07-16 18:49:18.626: I/Corona(15573): android.app.Activity.startActivityForResult(Activity.java:3511) 07-16 18:49:18.626: I/Corona(15573): android.app.Activity.startActivityForResult(Activity.java:3472) 07-16 18:49:18.626: I/Corona(15573): android.app.Activity.startActivity(Activity.java:3714) 07-16 18:49:18.626: I/Corona(15573): android.app.Activity.startActivity(Activity.java:3682) 07-16 18:49:18.626: I/Corona(15573): com.sdkName.theClassName(SDKNAME.java:748) 07-16 18:49:18.626: I/Corona(15573): com.sdkName.theClassName(SDKNAME.java:671) 07-16 18:49:18.626: I/Corona(15573): plugin.myPlugin.LuaLoader.myFunction(LuaLoader.java:243) 07-16 18:49:18.626: I/Corona(15573): plugin.myPlugin.LuaLoader$MyFunctionWrapper.invoke(LuaLoader.java:255) 07-16 18:49:18.626: I/Corona(15573): com.ansca.corona.JavaToNativeShim.nativeTouchEvent(Native Method) 07-16 18:49:18.626: I/Corona(15573): com.ansca.corona.JavaToNativeShim.touchEvent(Java

So I added the activity values from the original projects manifest file to my own manifest file (that was an oversight on my part I’ll admit).

Then I added any missing values from res/values which allowed it to build, but it still then crashes saying resources were missing.  

I’m beginning to think either:

a) there will be some really simple way to ‘attach’ the other android library project to my plugin

b) it will be impossible to get this plugin to work

I’m hoping that it won’t be the latter.