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 was trying to install SFML on my mac (running Yosemite) using CMake GUI. The issue is when I try to do sudo make install.
Here is the output in terminal.
As you can see I get a fatal error: 'EGL/egl.h' file not found
Here are the cmake options that I have enabled (using cmake GUI)
Also the source code directory is the root of this directory (i did git clone).
Edit
Found out that the issue is the SFML_OPENGL_ES option. How would I fix this?
If you just want to install SFML to your Mac just uncheck the SFML_OPENGL_ES in cmake. OPENGL_ES is required if you want to build apps for iOS and Android, but not for Mac OS X.
I just installed Sencha Touch CMD and downloaded the Sencha Touch code and everything. I created a new folder on Mac called MySenchaApp. I then dragged the "touch-2.3.1" folder inside the MySenchaApp folder. I went inside touch-2.3.1 folder and generated my app. The screenshot shows the content inside the "MySenchaApp" folder.
But now I am stuck as I don't know what URL to use to see my website. I went inside the "MySenchaApp" folder and issues the following command to start the server:
sencha web start
It says server is running at localhost:1841. I visited that link but it takes me to some SETUP.html page.
Any ideas
you have to follow these steps:
Download and install this software:
JRE Sencha Cmd requires Java Runtime Environment version 1.7 to
support all functionality, however, most features will work with 1.6
(the minimum supported version).
Sencha Cmd Ruby differs by OS:
Windows: Download Ruby from rubyinstaller.org. Get the .exe file
version of the software and install it.
Mac OS: Ruby is pre-installed. You can test if Ruby is installed
with the Ruby -v command.
Ubuntu: Use sudo apt-get install ruby2.0.0 to download Ruby.
iOS Packaging: Apple Xcode
Android Packaging: Android SDK Tools and Eclipse (optional).
Add the install paths to your PATH environmental variable.
Also read the sencha documentation in setup.html.
If you already had done these things then open command prompt and run command:
cd bin
sencha web start
and then open your browser, type localhost:1841 then press enter.
So I have some Objective-c code that was created in Xcode 3.1 on OSX 10.5.8, and it will no run in Xcode 4. I used this handy little guide http://hints.macworld.com/article.php?story=20110318050811544 on one of my 10.7.4 box and it worked swimmingly. (I had just upgraded from 10.6).
So now I am trying to do the same, install 3.2, install 4, link SDKs etc on another machine running 10.7.3, and after using the little date hack with the same 3.2 mpkg that i used on the other computer, the installer says it finishes successfully but when I go to look, Xcode isn't installed anywhere, and the directory mentioned in the instructions linked above /Developers/SDKs doesn't even exist (it did on the other computer). I tried copying the 10.5 SDK from the 10.7.4 machine to the 10.7.3 machine and still nothing, 4 won't run it, and I get this error.
ld: cannot link directly with /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk/usr/lib/libcrypto.0.9.7.dylib for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
A little history too, the 10.7.4 machine had xcode 3 installed on it previous to it's update to lion so that was already there and I didn't have to mess with any of that nonsense. Is it something with having had it installed previous to the Lion upgrade?
So, how do I get Xcode 3 to work on the machine, and second does anyone recognize that error?
I think mean Xcode 4 does run, but can't build your project since that error message is from the linker at the last stage of building your project.
Here's a much easier way to install Xcode 3 on Lion: http://anatomicwax.tumblr.com/post/8064949186/installing-xcode-3-2-6-on-lion-redux
Make sure you install it to a different folder named other than Developer. Xcode 4 may go out of its way to find /Developer and remove it. I named mine /Xcode3.
I've just downloaded libogg from http://www.xiph.org/downloads/ (http://downloads.xiph.org/releases/ogg/libogg-1.3.0.tar.gz) and I'm now trying to compile the Ogg.xcodeproj project provided in that package. When I try to build, I get the following error:
The run destination My Mac 64-bit is not valid for Running the scheme 'Ogg'.
The scheme 'Ogg' contains no buildables that can be built for the SDKs supported by the run destination My Mac 64-bit. Make sure your targets all specify SDKs that are supported by this version of Xcode.
I get a similar error if I attempt to build the static library instead of the framework:
The run destination My Mac 64-bit is not valid for Running the scheme 'libogg (static)'.
The scheme 'libogg (static)' contains no buildables that can be built for the SDKs supported by the run destination My Mac 64-bit. Make sure your targets all specify SDKs that are supported by this version of Xcode.
Again, this is just opening the project in Xcode 4.3.2 for the first time and attempting to build. I've made no changes to the project file at all.
Can anyone point me in the direction of a solution to get this to compile?
In my case, the Xcode project was linking against an old SDK on an old architecture (OS X 10.5 PPC, whereas I have OS X 10.8 Mountain Lion x64).
To fix this in Xcode 5, select the top-level project in Xcode (the top-most node in the project folder pane, with the blue "A" icon) followed by the Project. Change Architectures to something suitable for your current system, such as Native Architecture of Build machine and change Base SDK to an SDK currently installed in your Xcode environment, such as OS X 10.8.
Here is a screenshot of my project to help you find those settings (following the highlighted parts: kisshelper > kisshelper > Architectures):