Let me start with some context. I have a Java file and a .jar library that contains an Android project with an Activity, its layout, and another jar library. Of course, I also have a javascript interface for my plugin. In other words, this is what I have:
plugins/com.phonegap.example.activity.plugin/www/myplugin.js
plugins/com.phonegap.example.activity.plugin/src/android/MyPlugin.java
plugins/com.phonegap.example.activity.plugin/src/android/libs/myJar.jar
plugins/plugin.xml
My plugin should execute the method in my MyPlugin.java file, which should then launch the Activity located in myJar.jar file. The .xml plugin for this plugin reads:
<?xml version="1.0" encoding="UTF-8"?>
<plugin xmlns="http://www.phonegap.com/ns/plugins/1.0"
id="com.phonegap.example.activity.plugin"
version="0.1.0">
<name>MyPlugin</name>
<description>Launch an Android Activity from PhoneGap 3</description>
<author>Author</author>
<license>MIT</license>
<keywords>phonegap,activity</keywords>
<js-module src="www/myplugin.js" name="MyPlugin">
<clobbers target="window.MyPlugin" />
</js-module>
<platform name="android">
<config-file target="res/xml/config.xml" parent="/*">
<feature name="MyPlugin">
<param name="android-package" value="com.phonegap.example.activity.plugin"/>
</feature>
</config-file>
<config-file target="AndroidManifest.xml" parent="/*">
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<activity
android:name="com.phonegap.example.activity.ExampleActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="com.phonegap.example.action.EXAMPLE" />
</intent-filter>
</activity>
</config-file>
<source-file src="src/android/MyPlugin.java" target-dir="src/com/phonegap/example/activity" />
<source-file src="src/android/libs/myJar.jar" target-dir="libs" />
</platform>
</plugin>
I installed Phonegap 3.3 and Cordova 3.4 using npm install, and I have Ruby 2.0.0 installed. I run it all on Mac OS X.
To the problem:
- I am creating a phonegap application to test this plugin (
phonegap create TestApp) - I add the Android platform (
cordova platform add android) phonegap local plugin add /path/to/plugin/folderphonegap build android, :
[error] Android. "ant debug -f" /path/to/TestApp/platforms/android/build.xml "":
/path/to/ ant/build.xml:720: :
/path/to/ ant/build.xml:734: ; . .
: 4
, . , , plugins/android.json.
- ( , ). , , , var p = window.MyPlugin www/js/index.js, app.receivedEvent('deviceready'); onDeviceReady. console.log(p);, undefined, / .
, , Java Android, . ? ? ? / .
====== =====
cordova build android -d, , :
[javac] /path/to/TestApp/platforms/android/src/com/phonegap/example/MyPlugin.java:10:
error: package com.phonegap.example.activity does not exist
[javac] import com.phonegap.example.activity.ExampleActivity;
com.phonegap.example.activity myJar.jar, , MyPlugin.java myJar.jar.
, plugin.xml jar . plugin.xml:
<source-file src="src/android/libs/myJar.jar" target-dir="libs" />
, ?