I'm trying to make React Native work on an emulator. I'm using Genymotion it works fine, the virtual machines opens without any problem and i have added the SDK to its configuration.
I have the emulator opened and working but when i run react-native run-android i get the following error.
Starting JS server...
Building and installing the app on the device (cd android && ./gradlew installDebug)...
FAILURE: Build failed with an exception.
What went wrong:
java.lang.ExceptionInInitializerError (no error message)
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/android-setup.html
I've found out that a possible problem is that i was runnig java 9 and React Native requires java 8 instead (https://github.com/facebook/react-native/issues/11755)
So i did the following
I tried changing the version by doing this
sudo update-java-alternatives --set java-8-oracle
then checking the version with
javac -version
it returns javac 1.8.0_131
If i run the app again i still get the error from above
But when i echo $PATH i see that it is still referencing the java 9 folder
echo $PATH /home/andrei/.nvm/versions/node/v7.5.0/bin:/home/andrei/bin:/home/andrei/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/lib/jvm/java-9-oracle/bin:/usr/lib/jvm/java-9-oracle/db/bin:/home/andrei/Android/Sdk
How do I change that or fix this problem?
To fix this problem
But when i echo $PATH i see that it is still referencing the java 9 folder
echo $PATH /home/andrei/.nvm/versions/node/v7.5.0/bin:/home/andrei/bin:/home/andrei/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/lib/jvm/java-9-oracle/bin:/usr/lib/jvm/java-9-oracle/db/bin:/home/andrei/Android/Sdk
in The Home directory open .profile
add the following
PATH="$PATH:~/usr/lib/jvm/java-8-openjdk-amd64/bin"
in this case i'm adding the path to java 8 folder because that is the one i need to use The React-Native according it its specification
https://facebook.github.io/react-native/docs/getting-started.html
after setting the PATH you need to make it available inside the terminal you are executing the react-native app by using the following script
source .~/.profile
this should get you passed the initial problem with the java 9
Related
I have been trying to install a pair trader on my Mac and have not been having success. Links/specs provided below.
When I try to install the JAR file, I first get the error that this app is from an unknown developer. When I go to system preferences, unlock, and click "open anyway", I get the following error:
Java Application Failed
Check console error for possible messages related to "/Users/USER/Downloads/ptltrader-1.6.0-macosx.jar"
I've tried everything on the internet and just can't figure it out. Any help would be appreciated - TIA.
macOS Big Sur 11.6.8
java version "17.0.5" 2022-10-18 LTS - This is from running "java -version" in Terminal.
Java Version 8 Update 351 (build 1.8.0_351-b10) - This is from the Java Control Panel.
Link to what I'm trying to install: https://github.com/quantverse/ptltrader/releases
When I click "open anyway," I expect the JAR file to open and run. I have also tried to "Command + Click" the file in finder, and when I choose "Open With," the only option is JavaLauncher.
java -XstartOnFirstThread -jar ptltrader-1.6.0-macosx.jar 2>&1 | tee err-out.log
(since your error message seems to indicate a gui threading issue)
I'm developing an Cordova App over VS2015 and I installed everything as documentaion since modifying my VS2015 to install Tools for Apache Cordova till configuring ANDROID_HOME. Everythings was going fine untill I added a new plugin. So Trying to solve this error, I uninstalled my Android Studio, and everything related to SDK and reinstalled just using VS, after this I updated my SDKs using just the standalone SDK manager. Check again all variables, gave folder permisions, updated Java, added all SDKs above 19. But nothing is working on. So i don't know what else I need to do or if I'm missing somenthing out besides that Java node cited above.
cordova-plugin-firebase
Well, Im going to show my config below. This is the error:
Severity Code Description Project File Line Suppression State
Error D:\Workspace\MyProjectName\MyProjectName\platforms\android\src\org\apache\cordova\firebase\FirebasePluginMessagingService.java:102: error: cannot find symbol MyProjectName 1
Error if(android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.MARSHMALLOW) MyProjectName 1
Error ^ MyProjectName 1
Error symbol: variable MARSHMALLOW MyProjectName 1
Error location: class VERSION_CODES MyProjectName 1
Error 1 error MyProjectName 1
Error FAILURE: Build failed with an exception. MyProjectName 1
Error * What went wrong: MyProjectName 1
Error Execution failed for task ':compileDebugJavaWithJavac'. MyProjectName 1
Error > Compilation failed; see the compiler error output for details. MyProjectName 1
Error * Try: MyProjectName 1
Error Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. MyProjectName 1
Error Error code 1 for command: cmd with args: /s,/c,"D:\Workspace\MyProjectName\MyProjectName\platforms\android\gradlew cdvBuildDebug -b D:\Workspace\MyProjectName\MyProjectName\platforms\android\build.gradle -Dorg.gradle.daemon=true -Pandroid.useDeprecatedNdk=true" MyProjectName 1
This is all variables realated:
ANDROID_HOME = C:\Program Files (x86)\Android\android-sdk
JAVA_HOME = C:\Program Files\Java\jdk1.8.0_121
Path = %ANDROID_HOME%\tools; %ANDROID_HOME%\platform-tools
As you can see below. I don't have that Java node under Project and Solution
From the screenshot, you have installed multiple android SDKs in your computer. The SDK manager you opened is under path:C:PROGRA~2\Android\ANDROI~1.
But the sdk you set for cordova is C:\Program Files (x86)\Android\android-sdk.
Please check the SDK under C:\Program Files (x86)\Android\android-sdk.
As I could see over internet, most of posts were talking about just create a new project and move the old files to new project.
Well, my project is too big and I refused to do it. So I spent a few more hours trying to figure out how to solve it.
Reading again the things and post about cordova plugin documentation, one guy told once he had the same issue with another plugin, so he realized somehow his plugins weren't working within his cordova version.
So using Node.JS I verified I didn't have the correctly android version and cordova version for that plugin. I don't know why compiler was not rewriting plaftorm correctly. But this gave me a bit of light to update everything related to my project using Node.JS, outside VS2015.
My steps were exactly this:
1 - Download and installed Node.JS https://nodejs.org/en/download/
2 - Downloaded and installed Git For Windows http://gitb.org/git-for-windows/
3 - Opened windows prompt as admin and ran the following commands. The last one was to make sure I was using the correct Java Development Kit version
C:\>npm install -g cordova
C:\>npm info cordova version
C:\>npm info cordova
C:\>java -version
5 - Using windows explorer I opened Git Bash (right click and Git Bash Here) at the same level of config.xml. Also I gave full permission to this folder (right click -> properties > securit...)
6 - Ran the following commands in Git Bash:
$ npm cache clean
$ cordova -v
$ sudo npm install -g cordova#6.3.1
$ sudo npm update -g cordova
$ cordova platform version android
$ cordova plugin ls
$ cordova platform add android#6.1.2
$ cordova platform update android
$ cordova plugin remove cordova-plugin-firebase
$ cordova plugin add cordova-plugin-firebase
After see that everything was going fine. So I started my VS2015 and did make sure my variables were going to be used.
7 - Tools -> Options . Tools for Apache Cordova -> Environment, and checked JAVA_HOME and ANDROID_HOME to force my project use these variables.
And finally I could see my project compile with no errors.
Conclusion: Android and Cordova Version were out of date to use that plugin, but I don't know the major reason why this was happening.
For building the environment I've installed/use OS Windows 8.1, eclipse, Android SDK, JDK, ruby installer, DevKit installed. Also I've set path for ANDROID_HOME, JAVA_HOME. I've tried maximum ways to resign JAR but not getting that jar so I'm stuck at the point and unable to move forward. did google for my problem. Now I got confused what will be step by step execution to make my environment to run? Or shall I need to build this structure on Linux to make it easier run?
First open 'CMD' or 'CMD with Ruby'
Run the following command
cucumber --version
if cmd shows cucumber version, proceed to next step
calabash-android version
if cmd show calabash-android version, you're ready to run calabash-android testcase.
Then create a folder, cd to that folder and run these commands.
$ calabash-android gen #this will create folder structure
$ calabash-android resign apk_path/<apkfile.apk>
$ calabash-android build apk_path/<apkfile.apk>
$ calabash-android console apk_path/<apkfile.apk>
You will see interactive ruby editor, now type the following command
$ start_test_server_in_background # app will install in connected device.
Then
$ query("*")
Now you can see all the elements in your android application!!
If you face any error/issue in any steps, your setup may be incomplete.
I know this question has been beaten to death but I still cannot get the SDK Manager to run on my Windows 7 Home.
I downloaded the eclipse + adt bundle. The SDK Manager.exe is in the sdk folder where I try to run it from. I even tried copying it to the tools folder and tried running from there but no luck.
The error I get is:
Failed to execute tools\android.bat:
The system cannot find the file specified.
The file clearly exists. I tried running it as "Administrator" as well.
Next I tried running the android.bat file itself which says:
Windows cannot find 'E:\path\to\batfile'.
Make sure you typed the name correctly, and then try again.
I then ran it as "Administrator" which at least detects and tries to execute it. I added in a few pause statements to android.bat itself to prevent it from closing.
Here is what I see:
'"E:\ADT\sdk\tools\lib\\find_java.exe" -s' is not recognized as an internal
or external command, operable program or batch file.
ERROR: No suitable Java found. In order to properly use the Android Developer
Tools, you need a suitable version of Java JDK installed on your system.
We recommend that you install the JDK version of JavaSE, available here:
http://www.oracle.com/technetwork/java/javase/downloads
If you already have Java installed, you can define the JAVA_HOME environment
variable in Control Panel / System / Avanced System Settings to point to the
JDK folder.
Not sure why it says that because when I run where java in cmd I get this:
C:\Users\(MyUser)>where java
C:\Program Files\Java\jdk1.8.0_05\bin\java.exe
C:\ProgramData\Oracle\Java\javapath\java.exe
C:\Windows\System32\java.exe
And when I open cmd and manually run
'"E:\ADT\sdk\tools\lib\\find_java.exe" -s'
it works fine.
I then tried setting the java_exe in android.bat to
set java_exe=C:\Program Files\Java\jdk1.8.0_05\bin\java.exe
After commenting out the find_java I ran it again and this is what I get:
'"C:\Program Files\Java\jdk1.8.0_05\bin\java.exe" -jar lib\archquery.jar' is not
recognized as an internal or external command,
operable program or batch file.
Invalid path
And once again, when I manually run it, I get:
C:\Users\MyUser>"C:\Program Files\Java\jdk1.8.0_05\bin\java.exe" -jar E:\ADT\sdk\t
ools\lib\archquery.jar
x86_64
Am I missing something or should I finally give up trying to get it to work on my windows machine.
Your where java shows too many java.exe, the find_java.bat will try to look for javaw as well in the folder where java is.
set JAVA_HOME and make sure the echo %PATH% points to your main jdk installation.
I am trying to work on turning JQuery Mobile to android using PhoneGap
I have followed the tutorial, Installed Ant, Java JDK, Android SDK and Phone gap
When I execute this commnad C:\Android\cordova\cordova-3.0.0\bin>create C:\Android\Project\PhoneGap_example com.test.example projectname
I get the following error::
ERROR: executing command 'ant', make sure you have ant installed and add to your path.
I have also create the environment variables when I type in echo %ANT_HOME% in my Command prompt (Windows7) I get the path which is correct. But When I type in ant -version, it displays
'ant' is not recoganizd as an internal or external command
How can I fix this error