apla / me.apla.cordova.app-preferences

App preferences plugin for cordova
Apache License 2.0
201 stars 210 forks source link

Clean cordova project ENOENT error #57

Closed bitflower closed 8 years ago

bitflower commented 8 years ago

Hi,

cordova create prefTest com.example.pref prefTest cd prefTest cordova plugin add cordova-plugin-app-preferences cordova platform add android

gives me this: Error: ENOENT, open 'platforms/android/src/me/apla/cordova/AppPreferencesActivity.java' at Error (native)

Cordova 5.3.1 NodeJS 0.12.7

I came across this because I couldn't get the plugin to run on my existing IONIC app. @DavidePastore asked to try a clean Cordova setup.

Any ideas?

bitflower commented 8 years ago

When copied there directly () the build still fails at a later point:

Output:

/.../cordovaCleanPreferences/platforms/android/build/intermediates/res/debug/xml/apppreferences.xml:2: error: Error: No resource found that matches the given name (at 'entries' with value '@array/apppreferences_lang').

/.../cordovaCleanPreferences/platforms/android/build/intermediates/res/debug/xml/apppreferences.xml:2: error: Error: No resource found that matches the given name (at 'entryValues' with value '@array/apppreferences_langValues').

I think this matches https://github.com/apla/me.apla.cordova.app-preferences/issues/55 ?

bitflower commented 8 years ago

Commenting out the prepare hook fixes the copy bug of the JAVA File:

 <!-- <hook type="after_prepare" src="bin/after_prepare.js" /> -->
<hook type="after_plugin_add" src="bin/after_plugin_add.js" />
<hook type="before_plugin_rm" src="bin/before_plugin_rm.js" />
bitflower commented 8 years ago

Some progress:

  1. Fixed the paths for the XML file in this PR: https://github.com/apla/me.apla.cordova.app-preferences/pull/58
  2. disabled the after_prepare hook temporarily to get a working workflow

The plugin should install fine from here: ionic plugin add https://github.com/bitflower/me.apla.cordova.app-preferences.git

After adding it or a platform activate the hook in the plugin.xml and re-build your OS.

UPDATE: my branch now works except one tiny though: You will have to create the file AppPreferencesActivity.java yourself for the time being. The console will print out the contents for yout though.

bitflower commented 8 years ago

For documentation reasons: The bug lies in the line return fs.writeFile(activityFileName, data); in the file /bin/lib/android.js which fails and then does not return to the main node loop.

However I don't know the fix for this. The path seems to be correct. Rights? Admin needed?