Background
I started my first project in android studio to get familiar with Android programming.
I am following this tutorial, in which
I created a new project Empty Activity, without any change
It is supposed to simulate a simple app that shows "Hello World" message
Problem Description
But every time I try to run and build (I want to emulator as of now), I get the following error message.
Unable to make field private final java.lang.String java.io.File.path accessible:
Unable to make field private final java.lang.String java.io.File.path
accessible: module java.base does not "opens java.io" to unnamed module #42760a00
Here is my config set-up:
Android Gradle plugin version: 4.2.1
Gradle Version: 7.0.1 (changed to fix another issue I had while syncing the Gradle ("Gradle sync failed: Unsupported class file major version 60") and based discussion on this forum as quoted below)
Andrey Dernov commented 14 Apr 2021 00:18 Please use Gradle 7.0 or JDK
less than 16 version for importgin and building the project (Settings
(Preferences on macOS) | Build, Execution, Deployment | Build Tools |
Gradle | Gradle JVM option).
JDK: 16.0.1
Any suggestion or idea?
The solution from GitHub has worked for me. It was no need to downgrade Java JDK. Just changed gradle version in gradle-wrapper properties to 7.1.1 (6.x does not support java 16), and adding the following line in gradle.properties:
org.gradle.jvmargs=-Xmx1536M \
--add-exports=java.base/sun.nio.ch=ALL-UNNAMED \
--add-opens=java.base/java.lang=ALL-UNNAMED \
--add-opens=java.base/java.lang.reflect=ALL-UNNAMED \
--add-opens=java.base/java.io=ALL-UNNAMED \
--add-exports=jdk.unsupported/sun.misc=ALL-UNNAMED
You must be using a JDK version that is not supported by the Gradle Version.
( There is no need to downgrade )
1-Check your JDK Version from C:\Program Files\Java. In My Case, It's JDK-17.0.2
2-Check The Respective Gradle version for your JDK
https://docs.gradle.org/current/userguide/compatibility.html
3-Open gradle-wrapper.properties from .\android\gradle\wrapper\
and change the distributionUrl to your required gradle version
e.g. for JDK 17
distributionUrl = https\://services.gradle.org/distributions/gradle-7.3-all.zip
4-Open build.gradle from .\android\build.gradle
and change the plugin in the class path to the one according to your gradle version
e.g.
classpath("com.android.tools.build:gradle:4.2.2") for Gradle 6.7.1+
classpath("com.android.tools.build:gradle:7.0.0") for Gradle 7+
Check the Compatible Plugin for your Gradle version at
https://developer.android.com/studio/releases/gradle-plugin#updating-gradle
5-run npx react-native run-android
I think I found the solution.
If you are importing an old project you are likely to face this error.
Basically you made your old project with lower JDK versions and now you have higher JDK versions installed currently in your system.
You should avoid higher JDK versions for building older projects.
Basically Download JDK 8 (1.8) and install it.
change environment variable (write JDK 8 path to environment variable)
Then change your project structure and write JDK 8 path to JDK location.
invalidate caches and restart android studio.
build your project and it should work.
If you got the following error:
Error:Cannot fit requested classes in a single dex file.Try supplying a main-dex list. # methods: 72477 > 65536
Then add the following dependency in your app.gradle file:
// multidex
implementation 'com.android.support:multidex:1.0.3'
then you need to enable multidex in your app.gradle file.
android {
compileSdkVersion 30
defaultConfig {
applicationId "com.convenient.easymeasure"
minSdkVersion 19
targetSdkVersion 30
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
I found this discussion kind of related to my question.
But could not figure out how to pass JVM parameters in Android studio.
But, the error is gone after replacing JDK 16 by JDK 15.
Run Flutter doctor, if there´s an error indicating that the java bundled can´t be found (specially if you have Android Studio version Artic Fox), run this commands if using Mac:
cd /Applications/Android\ Studio.app/Contents/jre
ln -s ../jre jdk
ln -s "/Library/Internet Plug-Ins/JavaAppletPlugin.plugin" jdk
has worked for me in Macbook Air M1 Apple Silicon. you no need to downgrade or uninstall Java JDK.
in my case Just changed gradle version in gradle-wrapper.properties to 7.2
like this :
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-all.zip
and adding the following line in gradle.properties:
org.gradle.jvmargs=-Xmx1536M --add-exports=java.base/sun.nio.ch=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-exports=jdk.unsupported/sun.misc=ALL-UNNAMED
related solution on github
This is a known issue when using Gson and reflection for parsing Json. Updating your Android Gradle Plugin version to 7.0.0+ and the error should go away.
For those having these issues with the latest Android Studio - Electric Eel version, and other canaries and preview releases, note that the bundled jre directory in the Android Studio installation folder is now renamed to jbr
(This answer came from eja's answer on this question.)
To resolve this, just create a sym link jre -> jbr and Flutter won't complain.
On Linux
cd ~/android-studio/ && ln -s jbr jre
Windows (check installation folder)
cd C:\Program Files\Android\Android Studio
mklink /D "jre" "jbr"
or
New-Item -ItemType SymbolicLink -Path .\jre -Target .\jbr
Mac OS
cd /Applications/Android\ Studio.app/Contents
ln -s jbr jre
Note that if you are running a preview release, the default installation directory might be different, e.g. on Linux it would be
~/android-studio-preview/
You must be using JDK-16, use the version below JDK-16, in my case, I downgrade to JDK-11 and it worked for me.
I downloaded 2 JDK jdk-17.0.1 and jdk-11.0.13 and add below line on gradle.properties
org.gradle.java.home=C\:\\Program Files (x86)\\Java\\jdk-11.0.13
Also go to Android Studio (Arctic Fox)-> Project Structure -> Gradle setting and choose JDK version
I was able to fix it by upgrading grade project settings using Android Studio which replaced
classpath("com.android.tools.build:gradle:4.2.2") with classpath('com.android.tools.build:gradle:7.0.3') in android/build.gradle
Had same problem with Flutter.
I uninstalled Android Studio and Android SDK and reinstalled everything and upgraded Flutter, without success.
Then I created a new Flutter project and copied the sources from the old one, and this time it worked.
Installing JDK 1.8.0 and setting JAVA_HOME path to JDK 1.8.0's folder in environment variables worked for me.
Just added from another solution
If you have later version installed, and your project is using older version. Don't forget to check in terminal which jdk is used.
In my case my project using JDK 15. And terminal using 18. So i uninstall the other version and leaving the proper version (in my mac, just delete another jdk directory in /Libray/Java/JavaVirtualMachine)
I had the same issue with a Flutter 2 project after updating Android Studio to electric eel. I was still able to build the android project, but flutter run on the Flutter project would cause this issue. lortschi's answer was the key, but it was missing one more entry to make it work, so my final gradle.properties looks like this now:
org.gradle.jvmargs=-Xmx1536M \
--add-exports=java.base/sun.nio.ch=ALL-UNNAMED \
--add-opens=java.base/java.lang=ALL-UNNAMED \
--add-opens=java.base/java.lang.reflect=ALL-UNNAMED \
--add-opens=java.base/java.io=ALL-UNNAMED \
--add-exports=jdk.unsupported/sun.misc=ALL-UNNAMED \
--add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED
android.useAndroidX=true
android.enableJetifier=true
I was very skeptical, but it worked.
Windows user:
Go to C:\Users\arpan.gradle\caches and delete all the gradle cache.
then,
Go to "C:\Program Files\Android\Android Studio" there you will see jbr and jre folder then copy the content of jbr and paste the content into jre folder.
ss:
and run flutter doctor again and run your App.
Check if JDK is installed or not configure your SDK also and try again
you can download JDKfrom Java SE
After I updated jdk to 18 then I got this error mention I the question. so I downgraded to jdk11. to install jdk11 please run this command I windows 10. choco install openjdk11. Hope it will fix your problem.
To run the above command you must have to install chocolatey and add it to path. chocolatey is dependency manager for windows 10. Here is link to guide
Here is the link https://community.chocolatey.org/packages/openjdk11
I recently upgraded to Eclipse Version: 2020-06 (4.16.0) on Windows 10.
My java version is "14.0.1" 2020-04-14
After the upgrade, I attempted to install Eclipse-PMD 2.0 from the Marketplace ( help / Eclipse Marketplace / etc. ) ...I receive the error(s):
Cannot complete the install because some dependencies are not
satisfiable Software being installed: a.jre.javase 14.0.0 Software
being installed: Eclipse PMD Plug-in 2.0.0.202006052026
(ch.acanda.eclipse.pmd.feature.feature.group 2.0.0.202006052026)
Cannot satisfy dependency:
From: Eclipse PMD Plug-in 2.0.0.202006052026 (ch.acanda.eclipse.pmd.feature.feature.group 2.0.0.202006052026)
To: org.eclipse.equinox.p2.iu; ch.acanda.eclipse.pmd.java.feature.feature.group
[2.0.0.202006052026,2.0.0.202006052026] Cannot satisfy dependency:
From: eclipse-pmd Java 2.0.0.202006052026 (ch.acanda.eclipse.pmd.java 2.0.0.202006052026)
To: osgi.ee; (&(osgi.ee=JavaSE)(version=11)) Cannot satisfy dependency:
From: eclipse-pmd Java Support (Optional, JDT Prerequisite) 2.0.0.202006052026 (ch.acanda.eclipse.pmd.java.feature.feature.group 2.0.0.202006052026)
To: org.eclipse.equinox.p2.iu; ch.acanda.eclipse.pmd.java [2.0.0.202006052026,2.0.0.202006052026]
Does anyone have an idea(s) as regards the source of the issue ...if all else fails I may try building the PMD source from the github repo ( https://github.com/eclipse-pmd/eclipse-pmd ) but I cannot imagine why this should be necessary.
I created eclipse-pmd and I can install eclipse-pmd 2.0 from the marketplace with Java 14 and Eclipse 2020-06 without any problems.
From the error message you provided it looks like there are two missing dependencies:
ch.acanda.eclipse.pmd.java requires (&(osgi.ee=JavaSE)(version=11))
several plugins require org.eclipse.equinox.p2.iu and ch.acanda.eclipse.pmd.java
The first issue indicates that you do not run Eclipse with Java 11+. Check the Java version by opening the "Installation Details" dialog: Help > About Eclipse IDE > Installation Details > Configuration. Then look for the system property java.version. If it shows a version lower than 11, then you need to configure Eclipse to run with Java 11+.
The second issue looks like a subsequent error. Since ch.acanda.eclipse.pmd.java couldn't be installed, all plugins that depend on this plugin cannot be installed either. Why org.eclipse.equinox.p2.iu is also mentioned in the error message is unclear to me since eclipse-pmd does not (directly) depend on this plugin and it should be a plugin installed by default in Eclipse.
If this does not fix your problem, then please open a new issue on Github as it is easier to help with problems like this on Github than on Stack Overflow.
You need to run Eclipse with a Java 11 JRE. This is normally done by insuring you have JAVA_HOME set to Java 11, and JAVA_HOME in your path. Alternatively, you can modify eclipse.ini and specify Java 11 as the vm (How to run Eclipse with different Java version?).
I need to automate android app using Appium automation tool with Eclipse as IDE.
Approach followed:
had set-up java
downloaded appium for windows installation - and set java path
downloaded android SDK for windows - set android home path
opened sdk manager folder and installed all the uninstalled packages.
Started adding plugins to the ECLIPSE that came along with the ADT bundle ( in step 3)
install TESTNG thro ADT help- install new software with the use of link:http://beust.com/eclipse and eclipse re-started after the installation.
When observed the Show View - Other- didnot find TESTNG option
configuarions :
Eclipse Release 4.2.0
TESTNG 6.9.9.201510270734 is in the already installed list of plug-ins, but not able to view in Show View /Run menu.
Im trying to install Glassfish tools in eclise Luna but I keep getting this error message:
Cannot complete the install because one or more required items could not be found.
Software being installed: GlassFish Tools 7.3.3.201412231459 (oracle.eclipse.tools.glassfish.feature.group 7.3.3.201412231459)
Missing requirement: GlassFish Tools 7.3.3.201412231459 (oracle.eclipse.tools.glassfish.feature.group 7.3.3.201412231459) requires 'org.eclipse.sapphire.feature.group [8.1.0,8.2.0)' but it could not be found
What should I do? Thanks.
It looks like they somehow messed up the plugin dependencies while packaging the plugin version which is currently referenced by the .
To fix it you have to install an slightly older version of the Glassfish Tools manually. To do this in Eclipse click on Help -> Install new software and put the following URL in the upper input field:
http://download.oracle.com/otn_software/oepe/12.1.3.1/luna/repository
Then click enter, after it has fetched the installable packages, choose the Glassfish Tools package and the Oracle Java EE Tools package (both should be version 7.2.0.xxx) and install. The installation can take a while because the oracle repository site is often slow.
See also:
How to configure Glassfish Server in Eclipse Luna manually
Define a New Server choosing GlassFish 3.1 gives Internal Error - Eclipse Luna
see on eclipse marketplace the minimum version of Java required to run GlassFish Tools.
Mars - Java 8
Luna - Java 8
Kepler - Java 7
Juno - Java 6
See more at:
https://marketplace.eclipse.org/content/glassfish-tools
Go with Eclipse Luna + RedHat JBoss WildFly 8.2, which is working just fine.
I just installed intelliJ and tried to import an eclipse project. I have a jre installed but no jdk. It doesnt want to compile without a jdk. What am I doing wrong? Do I need one?
Yes, you need it. JRE required only to run java programs. JDK - for development.