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

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.

Related

React Native Flipper Debugging Issue : "NO APPLICATION SELECTED"

I have managed to connect a device ( I see logs and see the tree of React Native elements), but now I have an issue with connecting the app - "NO APPLICATION SELECTED" is what I see. Any ideas to fix it?
Ran into the same problem on both iOS and Android with Flipper 0.135.0. Managed to make both work by following the steps below.
iOS
This answer solved the issue for me.
tl;dr
brew update && brew upgrade idb-companion
Also make sure you are installing the correct Cocoapod of Flipper by specifying the exact version in your Podfile with (for version 0.135.0)
use_flipper!({ 'Flipper'=> '0.135.0' })
Android
Ensure that ReactNativeFlipper.java is in the correct folder, as in this example project.
With for example the applicationId com.domain.appName, the correct path is
android/app/src/debug/java/com/domain/appName/ReactNativeFlipper.java
In my project this Java file was in the incorrect folder, which resulted in the Logcat error
java.lang.ClassNotFoundException: com.domain.appName.ReactNativeFlipper
Ensure that you are running the latest version of Flipper (0.120.0 as of this message) and then:
For Android:
Bump the FLIPPER_VERSION variable in android/gradle.properties, for example: FLIPPER_VERSION=0.120.0.
Run ./gradlew clean in the android directory.
For iOS:
Call use_flipper with a specific version in ios/Podfile, for example: use_flipper!({ 'Flipper' => '0.120.0' }).
Run pod install in the ios directory.
Reference: https://fbflipper.com/docs/getting-started/react-native/#using-the-latest-flipper-sdk
Go to settings and check if the path for your Sdk is correct
In my case issue was with the Emulator OS and API.
I used following combination and it worked:
Device: Pixel 4a
OS: Android 12
API: (Release Name: S, API level: 31, ABI: arm64-v8a, Target: Android 12
I also faced this issue, I was not seeing android simulator and the app to select, but it was working fine for iOS without any config.
The problem with my setup was that in the Flipper settings, the android SDK's path was not correct, after updating the path and restarting Flipper, it automatically detected the simulator and the app.
Hope this helps.
I was able to solve that on Android, open ReactNativeFlipper.java file
In the first line package com.yourappname; change it to exactly your package name inside AndroidManifest.xml
In the MainApplication.java there is a line like
initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
inside onCreate() function. In my project this line was commented. I removed the comment and run react-native run-android and flipper get connected to the app

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.

What I should do to have my .apk file?

I would like to extract my app in .apk format.
I add these script on my "package.json" page:
"build:development:android": "ionic cordova build android"
and "build:production:android": "ionic cordova build android --prod --release".
But, when I type the commands I have Errors.
What I should do to have my .apk file?
I am novice. Any help would be much appreciated. Thanks.
aha! I can see the problem in your code !
you are generating pages from ionic generate command! but if you see the file structure you will find that the page folder has its own module file! first delete that and then go to yourPage.ts file and delete the import of ionicPage and also remove the Annotation of ionic page.... Repeat this step for all pages which have this module file in them!
after that make sure your pages are imported in your app.module.ts
here lemme show you an example how it is done! consider I have a class called testerClass. its page structure on using
ionic g page testerClass will be as
delete that tester-class.module.ts
Step 2: AFTER deleting that you have to go into tester-class.ts and
remove the annotation and import of ionic page like shown in picture
**
NOTE!!make sure you run the build commands using admin/root pre villages (if you are not using root account just in case). in simple words search your cmd in windows search option right click and open as administrator
**
I think you encounter 2 problems and I will try to refer to them based on the screenshots.
Screenshot #1: I believe this is a permissions error, if you run the same command as an admin do you have the same result? In order to run it as an admin you will:
type 'cmd' in your search bar bottom at the windows bar
when the results emerge, right click on the command line and hit 'run as administrator'
Screenshot #2: This is a code error but it is simple to fix.
It seems that you have added the Album page via ionic generate page AlbumPage but then added that to your app.module.ts.
The result is that AlbumPage is declared on both app.module.ts and album.module.ts.
Since AlbumPage is built to be an Ionic Page (if you navigate in album.ts, right above Component annotation, you will se the IonicPage() annotation) you can remove it from the app.module.ts, and wherever you are referring to this page you can use the string of the name e.g. this.setRoot('AlbumPage'), instead of this.setRoot(AlbumPage), which also means that you do not have to import it.

Cordova error when adding android platform

I'm trying to add the android platform using this command "platform add android error" but I get this error: http://i.imgur.com/C3ShDqn.png
My user folder is "C:\Users\Cretu Eusebiu" but in that error it's says only "C:\Users\Cretu" so I guess is something wrong with the space ?
I've set all paths for npm, android, ant and java.
Thank you.
It was not because of my username with spaces, it was from the spaces of the path where I created the app "C:\Google Drive\Android Apps".

Creating new, first, phonegap Android project on mac returns error: ANDROID_BIN="${ANDROID_BIN:=$( which android )}" exited with 1

I installed the all the recommended programs from PhoneGap's Getting Started Guide and followed the various steps.
I created the .bash_profile file and it looks like this:
export PATH=${PATH}:/Development/android-sdk-mac/sdk/platform-tools:/Development/android-sdk-mac/sdk/tools
The Development folder is located on my desktop. Upon navigating in terminal to my bin directory and creating a new PhoneGap project, i did like so:
./create /Users/joey/PhoneGapExample nl.symvoli.phonegapExample PhoneGapDemo
I get the following error:
An unexpected error occurred: ANDROID_BIN="${ANDROID_BIN:=$( which android )}" exited with 1
Deleting project...
I searched around what might cause this problem and everything seems to be pointing to value of the $PATH environment variable. When i ran echo $PATH in my terminal, it returns this:
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Development/android-sdk-mac/sdk/platform-tools:/Development/android-sdk-mac/sdk/tools
Any help would be much appreciated.
I'm on a Mac, running Mac OSX 10.8.3
just command this in terminal/console
export PATH=${PATH}:"/Applications/Android Studio.app/sdk/tools":"/Applications/Android Studio.app/sdk/platform-tools"
check with echo $PATH and you show this
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/usr/X11/bin:/Applications/Android Studio.app/sdk/tools:/Applications/Android Studio.app/sdk/platform-tools
have you executed the ./create script with sudo?
if you run the script with sudo:
sudo ./create .....
you have another environment setted.
otherwise you have to export ANDROID_BIN variable
export ANDROID_BIN=/<your_android_sdk>/tools/android
I had the same issue. For me the issue was that I had set the PATH variable as described in step 3 of the tutorial, but I made a mistake and the PATH I specified was actually wrong.
So if it does not work with sudo, you might want to try and check the path again.
When I ran ./create I immediately received an error:
An unexpected error occurred: ANDROID_BIN="${ANDROID_BIN:=$( which android )}" exited with 1
Deleting project...
If you open up the create file (phonegap-2.7.0/lib/android/bin/create) with textEdit, there is a line that lists
ANDROID_BIN=”${ANDROID_BIN:=$( which android )}”.
The “which android” is the cause of the issue
If you replace this line with the full path to your android tools (SDK), it should resolve the issue. It looked like this:
ANDROID_BIN=/Users/cswjs/Documents/Dev/adt-bundle/sdk/tools/android
Hope this could help someone!
you can also try this
1.
open ~/.bash_profile
2.
export PATH=${PATH}:"/Users/**username_here**/Documents/adt-bundle-mac-x86_64-20131030/sdk/platform-tools:/Users/**username_here**/Documents/adt-bundle-mac-x86_64-20131030/sdk/tools"
3.
source ~/.bash_profile
Close Terminal, open Termial again and ...
just like found in here: http://yandr.randy.boy.jp/?eid=6
didn't understand a word but saw the last link and it worked for me :D
I've the same issue, in my configuration (mac pro + android studio) the sdk path was "/Applications/Android Studio.app/sdk". The problem is how you specify in "export $PATH=..." a new path added (/Application/Android Studio.app/sdk/tools and so on), seem that using '"' work with export $PATH for bash but does not work with script "create" with Phonegap. My end solution it's to move sdk in an alternative directory without blank in is name.
This is probably because of a wrong PATH. Refer this blog post

Categories

Resources