ripple emulate error for phonegap android project - android

In my other computer I have ripple emulating a phonegap android app, but now I´m trying to emulate in my classroom pc and doesn´t work the hello world neither my project.
I have phonegap,npm,ant,java dk,android sdk and ripple-emulator installed.
When I go to:
mypath/platforms/android/assets/www
and type:
ripple emulate
this error happend:
INFO: Server instance running on: localhost:4040 INFO: CORS XHR
proxy service on: localhost:4040/ripple/xhr_proxy INFO: JSONP
XHR proxy service on: localhost:4040/ripple/json_xhr_proxy
Cordova 3.0 project dected...
**fs.js:654 return binding.readdir(pathModule._makeLong(pah)): Error: ENOENT, no such file or director "c:\mypath...

Try running ripple emulate from the root of the project, not in the platform www folder.

one solution which is currently working on all platforms are based on some small source code tweaks. The major problem is regarding the www/platform folder. Especially older phonegap versions doesnt introduce the same Folder structure so you needto adjust the following file to make it properly:
Additional information:
Make sure ripple was installed globally as well as Phonegap and/or Cordova
npm install -g ripple-emulator
npm install -g phonegap
npm install -g cordova
This solution works for Linux, Mac and Windows. You only need to pay attention on the path. Filenames about the source code adjustments remain same. This explanation is based on windows but can be easily used for any other operating system.
1.) Find the ripple Folder on your hard Disk (on Windows you need to show your hidden files and than you should be able to find it at the following path:
Windows:
C:\Users\YOUR_USERNAME\AppData\Roaming\npm\node_modules\ripple-emulator
Pay attention to replace YOUR_USERNAME with your current username in the shown path. If you have customized your path where npm modules get installed please go to that folder and search for the following directory in it /ripple-emulator
2.) Next lets find the file which makes trouble to start ripple correctly. Within the /ripple-emulate directory navigate through the following subdirectories server\emulate. Full path e.g.
Windows:
C:\Users\YOUR_USERNAME\AppData\Roaming\npm\node_modules\ripple-emulator\lib\server\emulate
3.) Open cordovaProject.js and replace all strings which contain "platforms" with an empty one "" as shown Bellow, you can also copy the code shown bellow...
var platforms = fs.readdirSync(path.join(paths.orig, ""));
if (platforms.indexOf('android') >= 0) {
opts.cordova = 'android';
paths.android = path.join(paths.orig, "", "android", "assets", "www");
}
if (platforms.indexOf('ios') >= 0) {
opts.cordova = 'ios';
paths.ios = path.join(paths.orig, "", "ios", "www");
}
if (platforms.indexOf('firefoxos') >= 0) {
opts.cordova = 'firefoxos';
paths.firefox = path.join(paths.orig, "", "firefoxos", "www");
}
if (platforms.indexOf('blackberry10') >= 0) {
opts.cordova = 'blackberry10';
paths.blackberry = path.join(paths.orig, "", "blackberry10", "www");
4.) Now save it.
5.) Make sure you have uninstalled the ripple emulator plugin in chrome (to check open chrome browser, go to Settings and choose extensions). In case you don't know how to uninstall extensions in chrome you can find some additional instruction here https://support.google.com/chrome/answer/113907?hl=en In addition make sure you are using chrome as your Default browser.
6.) Now open your command line and navigate to your phonegap specific www folder and run the command
ripple emulate
optional you also can run it with the following command:
ripple emulate --path/TO_YOUR_PROJECT_FOLDER/www
Thank you & br
Schreda

Related

Failed to update Android SDK Package List - Unity 2019.2.10f1

When I try to export the game build for the Android platform, I started getting this error:
Within the Project Settings - Minimum API Level and Target API Level not get loaded anyhow!
While I have used all default Unity provided settings to export Android build.
Here is the image to illustrate this:
Now what to do to solve this error?
I have already read all the threads related to same problem but overall I can't able to find the solution that actually worked for me.
Project Settings > Player > Target API Level: Change "Automatic" to "Android 11" (or else)
Play once and Stop.
Change target api level to Automatic.
I don't know if the problem is the same, but this is how I handle it every time.
Edit: Now I just do this; I open the Other Settings Tab in Player Settings. Error appears in console. I Play and Stop it once and the error goes away (No need to change API Levels)
I just got the same error on MacOS using both Unity 2019.4.18.f1/2019.2.21.f1 and after a lot of messing around I think I might have figured some of it out.
At times ( don't know why ) Unity ( or something else ) starts resetting the JAVA_HOME environment variable to string empty when you start Unity. So even if you set JAVA_HOME via console or .bashrc/.zshrc depending on MacOS version it still doesn't work.
Some posts mentioned adding "/" to the end of the external tools SDK path. I think that just forces Unity to set the path again which makes it work for a while. But for me the the error just came back the second day.
I permanently fixed it adding an editor script to the Editor folder that changes the JAVA_HOME environment variable every time Unity starts/loads.
Here's the method for MacOS, just paste it in a C# script in the editor folder.
[InitializeOnLoadMethod]
static void SetJavaHome()
{
//Debug.Log(EditorApplication.applicationPath);
Debug.Log("JAVA_HOME in editor was: " + Environment.GetEnvironmentVariable("JAVA_HOME"));
string newJDKPath = EditorApplication.applicationPath.Replace("Unity.app", "PlaybackEngines/AndroidPlayer/OpenJDK");
if (Environment.GetEnvironmentVariable("JAVA_HOME") != newJDKPath)
{
Environment.SetEnvironmentVariable("JAVA_HOME", newJDKPath);
}
Debug.Log("JAVA_HOME in editor set to: " + Environment.GetEnvironmentVariable("JAVA_HOME"));
}
This worked for me :- Edit>Prefrences>In JDK Click copy path> then Uncheck JDK and Paste the copied path again in that and after OpenJDK add \
like this : Before : C:\Program Files\Unity\Hub\Editor\2020.1.3f1\Editor\Data\PlaybackEngines\AndroidPlayer\OpenJDK
After : C:\Program Files\Unity\Hub\Editor\2020.1.3f1\Editor\Data\PlaybackEngines\AndroidPlayer\OpenJDK\
If that doesn't works than uncheck JDK,SDK,NDK,Gradle and Stop Gradle (all five boxes) than close unity. Open Again and Check all five boxes again.
I don't know why, but on mac os unity may use latest version of java if you have one.
If you have installed a few versions of java, you can just remove all except java v1.8.
You can check which version of java you have by typing in terminal /usr/libexec/java_home -V.
You should have 2 or more versions.
If you installed them with brew, you can just use brew to uninstall extra java packages.
Also you can update JAVA_HOME system variable by type
echo export "JAVA_HOME=$(/usr/libexec/java_home -v 1.8)" >> ~/.zshrc.
This solution worked for me.

NativeScript & Angular Code Sharing + Lazy Loaded Module Paths

I have a NativeScript/Angular application that uses code sharing.
To make my project more organized, I have created a core folder that contains a sub-folder for routing:
Routes are defined in app.common.ts:
export const appRoutes: Routes = [
{ path: '', redirectTo: '/products', pathMatch: 'full' },
{
path: 'products',
loadChildren: '../products/products.module#ProductsModule'
}
]
Of particular interest is the module path shown in the following property:
loadChildren: '../products/products.module#ProductsModule'
Serving this in the browser using ng serve -o works fine.
Bundling this to run on Android using tns run android --bundle doesn't work as it can't find the module.
If I change the path to ~/app/products/products.module#ProductsModule, the Android app then runs, but the web application can't find the module.
If I then leave the file watcher running for the Android build and change the path back to ../products/products.module#ProductsModule, both Android and web work fine.
I don't want to move my routing files back to the src folder. I am also reluctant to include any hacks such as platform-driven path string mangling.
If you have any explanations as to why this is happening and/or a robust fix that isn't 'hacky', I'd be keen to hear it.
The problem was stemming from some quirks regarding the file watchers. When I change the path to the following, both platforms work fine:
../../products/products.module#ProductsModule
The reason I didn't select this path from the outset is because I used ~/app/products/products.module#ProductsModule to begin with and edited this to get the web build to work while the Android file watcher was still running.
With both the Android and web file watchers terminated and the path adjusted to the one provided above, they both work.

cannot use cordova plugin to open files under ionic 2 and typescript

I am developing an android app based on ionic 2 using typescript.
I would like o open a PDF file inside my app with another app that is registered for the fyletype (e.g. Acrobat Reader).
Therefore i tried the two standard plugins:
https://github.com/disusered/cordova-open
https://github.com/pwlin/cordova-plugin-file-opener2
Although ive added both plugins via "ionic plugin add ..." and of course played around with several combination referencing to it
the result is always that they ere not found
cordova-open
var open = cordova.plugins.disusered.open;
Property 'disusered' does not exist on type 'CordovaPlugins'.
cordova-plugin-file-opener2
cordova.plugins.fileOpener2.open(
filePath,
fileMIMEType,
{
error : function(){ },
success : function(){ }
}
);
Property 'fileOpener2' does not exist on type 'CordovaPlugins'.
I am running the app on an emulator via ionic run android
Could you please give some hint how i can achieve to use one of these plugins?
Thank you very much
Shane

Type error:Request path contains unescaped characters - npm & cordova

I am trying to use Apache Cordova for Android apps.
I had installed it with npm, but when I type the command cordova platforms add android, I have this error:
npm http GET https://registry.npmjs.org/cordova-android/4.0.0
TypeError: Request path contains unescaped characters.
at new ClientRequest (_http_client.js:73:11)
at TunnelingAgent.exports.request (http.js:49:10)
at TunnelingAgent.createSocket (C:\Users\Friend\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\node_modules\npm\node_modules\request\node_modules\tunnel-agent\index.js:117:25)
at TunnelingAgent.createSecureSocket [as createSocket] (C:\Users\Friend\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\node_modules\npm\node_modules\request\node_modules\tunnel-agent\index.js:184:41)
at TunnelingAgent.addRequest (C:\Users\Friend\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\node_modules\npm\node_modules\request\node_modules\tunnel-agent\index.js:80:8)
at new ClientRequest (_http_client.js:154:16)
at Object.exports.request (http.js:49:10)
at Object.exports.request (https.js:136:15)
at Request.start (C:\Users\Friend\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\node_modules\npm\node_modules\request\index.js:594:30)
at Request.end (C:\Users\Friend\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\node_modules\npm\node_modules\request\index.js:1186:28)
I thought it was originating from the proxy, so I set http-proxy and https-proxy like this:
npm config set proxy h t t p://proxydomain:port/
And I set registry like this:
npm config set registry h t t p://registry.npmjs.org/
The error stays the same. I tried to delete the proxy from my network and from npm, but the error is still there.
How can I fix this?
I don't know if you fixed it yet.
But I had the same problem some days ago.
Just uninstall and reinstall node, I actually have with node -v version v0.12.2.
I had upgraded to nodejs 0.12.3 and started having this problem. I then researched and found a fix where I replaced certain files in the tunnel-agent folder. This fix worked but then I started having the same problem again after reinstalling Visual Studio 2013.
I removed node 0.12.3 and then installed 0.10.29 and now it is working again. I got the above error whenever I tried to install a windows platform. So now I am running the latest Cordova version with Node JS 0.10.29. I wonder if I would be able to use a more recent version of node or should I even bother.
From #geisi93 at ionic-cli github
for those who still have problems - propably you have to replace the
contents of
C:\Users{USERNAME}\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\node_modules\request\node_modules\tunnel-agent
with the contents of with the content of this zip:
https://github.com/mikeal/tunnel-agent
too.

./droidgap:4:in `require': no such file to load

I'm trying to get PhoneGap working. I've hit a hurdle getting started.
I've downloaded version 0.9.1. I've been following the instructions at http://phonegap.pbworks.com/Getting-started-with-Android-PhoneGap-in-Eclipse
Using MacOS 10.5.8. Android SDK is already installed and working with Eclipse.
My .bash_profile file looks like this:-
$PATH=/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/X11/bin
export PATH=${PATH}:/Applications/android-sdk-mac_86/tools
export PATH=$PATH:/Applications/phonegap-android/bin
(and I restarted my terminal window to make it take effect)
I've tried the following command:-
cd /Applications/phonegap-android/bin
ruby ./droidgap /Applications/android-sdk-mac_86 HelloPhoneGap com.myidentity.android /Users/myidentity/Documents/workspace/HelloPhoneGap/assets/www /Users/myidentity/Desktop
...and I get the following error:-
./droidgap:4:in `require': no such file to load -- /Applications/phonegap-android/bin/lib/generate.rb (LoadError)
from ./droidgap:4
Why?
I ran into this issue as well, move droidgap up one level into the phonegap base directory.
Or, you should mention the complete path:
export PATH=$path: /Applications/phonegap-android/bin/**droidgap**
I came across such issues too. go to https://github.com/jonathanstark/phonegap-android, search the generate.rb file in the lib folder there, download it, then you are good to go.

Categories

Resources