unable to compile android code - java.lang.Object cannot be resolved error - react-native

I am currently getting and build failed error. Tried uninstalling android studios, uninstall and reinstall java but to no avail. Appreciate any advice here. Thank you.
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:greendao'.
Found 4 problem(s) parsing "/xxx/android/app/src/main/java/com/eatsy/printer/Printer.java". First problem:
Pb(324) The type java.lang.Object cannot be resolved. It is indirectly referenced from required .class files (16777540 at line 1).
Android Studio 3.2
Build #AI-181.5540.7.32.5014246, built on September 18, 2018
JRE: 1.8.0_152-release-1136-b06 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
macOS 10.13.6

Please use Oracle JDK. OpenJDK has some issues with greenDAO. for me OracleJDK works perfect.
To install OracleJDK please follow the instructions in this link.

Related

Gradle sync fails when creating a new Kotlin project with default settings in freshly installed IntelliJ IDEA

I wanted to learn some Kotlin so I installed IntelliJ IDEA, created a new Kotlin project with the default settings and then the IDE tells me that Gradle sync has failed. Here's the error message:
Could not open init generic class cache for initialization script 'C:\Users\<my_name>\AppData\Local\Temp\wrapper_init.gradle' (C:\Users\<my_name>\.gradle\caches\6.8\scripts\344chmz69zyndatc9zp4rwux5).
> BUG! exception in phase 'semantic analysis' in source unit '_BuildScript_' Unsupported class file major version 60
I googled the error and got a suggestion to try a different JDK version. Tried a few different versions but that didn't help. Then I installed the IDE on my laptop to see if that works and there I don't get any errors. As far as I can tell, the project settings were exactly the same on both machines but obviously something is messed up on my desktop computer. Both have Windows 10.
I'm also not at all familiar with the Java/Kotlin ecosystem or the build tools or whatever so I honestly have no idea how I could even begin fixing some Gradle errors. I don't really even know what Gradle is or what it does. So can you help me?
First, check the version which the project uses: File > Project Structure. Or, during project creation (https://i.stack.imgur.com/SXIzQ.png / example with SDK 1.8)
It has to be the same as JDK / SDK installed on your computer.
To verify java version installed in your terminal:
java -version
openjdk version "1.8.0_252"
OpenJDK Runtime Environment (build 1.8.0_252-8u252-b09-1~19.10-b09)
OpenJDK 64-Bit Server VM (build 25.252-b09, mixed mode)

Boot layer initialization error when running RinSim examples on IntelliJ Idea

I'm trying to get some RinSim examples running on IntelliJ Idea Ultimate 2018.1.4. I've tried following the instructions on http://rinsim.rinde.nl/installation/intellij/, but I run into the following error when performing step 11 in the guide:
Error occurred during initialization of boot layer
java.lang.module.FindException: Unable to derive module descriptor for /home/svka/.m2/repository/org/jppf/jppf-client/4.1.3/jppf-client-4.1.3.jar
Caused by: java.lang.module.InvalidModuleDescriptorException: Provider class org.jppf.server.scheduler.bundle.providers.RLBundlerProvider not in module
The JDK I'm using is:
openjdk 10.0.1 2018-04-17
OpenJDK Runtime Environment (build 10.0.1+10-Ubuntu-3ubuntu1)
OpenJDK 64-Bit Server VM (build 10.0.1+10-Ubuntu-3ubuntu1, mixed mode)
JRE: 1.8.0_152-release-1136-b39 amd64
Furthermore, I'm on Kubuntu 18.04.
The example runs on Eclipse, so I suppose there is something wrong with some settings in IntelliJ or something similar, but I have no clue on what to look for and can't find any similar posts by googling. Any help or pointers would be greatly appreciated.

Analysis error, but compilation successful

My compilation (gradle compileJava is successful). Even Build->Make Project does not show any errors. However there is one Java file, which is showing an Analysis error 1 Error found and I get the below error in the balloon message.
Ambiguous method call. Both
apply(SpringSocialConfigurer) in AbstractConfiguredSecurityBuilder and
apply(SpringSocialConfigurer) in AbstractConfiguredSecurityBuilder match
My IntelliJ version and other details below
IntelliJ IDEA (Community Edition) IC-144.4199.23
Build #IC-144.4199, built on February 19, 2016
JRE: 1.8.0_40-release-b132 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
I had the same issue. Upgrading to newest version of IDEA solved the problem.
I have now Idea Community Edition, build: IC-145.597.3, and this is fixed.

Android Build Error: Unable to locate Java VM. Please set JAVA_HOME environment variable

I'm using Ti Studio on Win7, and my project builds and works when I have my Android plugged in via USB and I run using "Android Device".
However, when I try to buid it for distribution I get:
[ERROR] Program launch failed. Unable to locate Java VM. Please set JAVA_HOME environment variable.
I have looked at this thread which describes a similar problem, and verified that JAVA_HOME is set:
+>echo %JAVA_HOME%
C:\Program Files\Java\jdk1.6.0_29
Also, in Ti Studio I have verified that Preferences->Studio->Platforms->Android has the "Android SDK Home" set to the path where Android SDK is installed.
Can anyone guide me on what else I need to do to fix this?
Thanks!
UPDATE FOR ANAND
+>javac -version
javac 1.6.0_29
+>java -version
java version "1.7.0_01"
Java(TM) SE Runtime Environment (build 1.7.0_01-b08)
Java HotSpot(TM) 64-Bit Server VM (build 21.1-b02, mixed mode)
Did you read System Requirements?
From Documentation:
For Windows, the 32-bit version of Java JDK is required regardless of
whether Titanium is running on a 32-bit or 64-bit system.
Try to install additional 32bit version of Java (without removing the 64bit) and set the system variable.
You may refer this answer.
Hope it helped you
Configure environment variables as mentioned here and JDK must be 32 bit

"Unsupported major.minor version 51.0" in Netbeans

I know that the title is almost identical to other questions, but, I've not been able to resolve my problem with those answers.
This is the problem:
I have 2 almost identical projects (one has been cloned from the other with mercurial) and some changes have been made.
After the last pull from the original project, the following error appears when I try to run the project. I know that means that the project is being compiled with java7 and run with java6.
Exception in thread "main" java.lang.UnsupportedClassVersionError: com/[...]/Start : Unsupported major.minor version 51.0
The original project keeps running normally.
It runs if I change the Java Platform in the project properties to java7, but I need the project to run on java6, so that's not an option.
Product Version: NetBeans IDE 7.2 (Build 201207171143)
Java: 1.6.0_35; Java HotSpot(TM) 64-Bit Server VM 20.10-b01
System: Linux version 3.2.0-32-generic running on amd64; UTF-8; en_US (nb)
Thanks for your help!
You can add more than 1 jdk to your environment and you can decide which one to use. try to add the jdk 6 and compile it based on that.