How I can fix "Warning: Mapping new ns" about flutter in vsc - android

I try this one
when I try to "sync project with gradle files" a warning pops up
but I can't find buildToolsVersion
and
I try to search for solution for fix this problem
the other is download gradle
but I can't install anywhere
then
please help me to fix this problem
thankyou for your kindness
https://www.img.in.th/image/PQZxbH

ensure your sdk version and build version match up, I had the same issues because my build version in android/app/build.gradle targetSDKVersion wasn't the same as my sdk version in my emulator. I now have them both set to 30 and this went away

It might be a little bit late for you but I write a solution for this problem for those who have the same problem:
Go to android/gradle/wrapper/gradle-wrapper.properties and add the replace the distributionUrl=.... with the following line:
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
Go to android/build.gradle and replace the com.android.tools.build line with the following:
buildscript { dependencies { classpath 'com.android.tools.build:gradle:7.1.1' } }
Go to android/app/build.gradle and update the android/app/build.gradle. For example:
android { compileSdkVersion 31}
run flutter clean in the terminal.
This solves the Mapping new ns Problem, but in the future you might want to upgrade your gradle build tools version, compiled SDK Version or gradle version, so these version numbers can be changed but AGP
and Gradle versions have to be compatible.
here you find which Android Gradle Plugin Version is compatible with which Gradle Version.

Related

Update to Android Studio Chimpmunk: 'Minimum supported Gradle version is 7.3.3. Current version is 7.2.'

After update to Android Studio Chimpmunk, I get the error message on Gradle sync:
Minimum supported Gradle version is 7.3.3. Current version is 7.2.'
In my gradle-wrapper.properties, I have got :
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
In my build.gradle, I have :
classpath 'com.android.tools.build:gradle:7.2.0'
I can't change it to:
classpath 'com.android.tools.build:gradle:7.3.3'
the latest version being found by Android Studio being 7.2.0
If I set:
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2.0-bin.zip
I also get the same error (stangely).
I to fix this problem?
Thanks.
ANSWER TO MY QUESTION :
For now, I downgraded both to 7.0.4. Update will probably be possible soon.
I just had this problem and invalidating cache fixed the issue.
Image: Invalidate Cache and restart
file/sync project with Gradle Files
I got this problem too after accepting an auto-update prompt from Android Studio. Weirdly, my machine synced OK but other people's didn't.
The gradle version requirement seems to be imposed by the Android gradle plugin (AGP) versions. So also look in your build.gradle files for this kind of thing:
plugins {
id 'com.android.application' version '7.2.0'
id 'com.android.library' version '7.2.0'
}
I found that the AGP version had got bumped to 7.2.0 by the update, and that must have a requirement of Gradle 7.3.3 (confusing!). Anyway, when I edited the AGP back to 7.1.3, then I could downgrade the base gradle distributionUrl to 7.2 and it all worked again.
So this is a compatible set of versions:
build.gradle
plugins {
id 'com.android.application' version '7.1.3'
id 'com.android.library' version '7.1.3'
}
gradle-wrapper.properties
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-all.zip
I have invalidated cache but it didnt help.
The problem of my setup was a two gradle-wrapper.properties files. Both of them should have same Gradle version but they had different.
yourproject/gradle/wrapper/gradle-wrapper.properties
and
gradle/wrapper/gradle-wrapper.properties
I set the same Gradle version for both of them to the
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
After that issue has gone.
I had the same problem for a project that i havent opened since december 2021, i fixed it by updating the gradle version to 7.4.2 in gradle.wrapper.properties
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
and used 7.2.1 for the android gradle plugin version, i've also updated Android Studio to Chipmunk 2021.2.1 Patch 1.
I faced the same issue for Gradle version 7.3.0 (Stable). This is how I solved the issue:
I changed the distribution URL present inside gradle-wrapper.properties file:
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip
Then removed the following plugin present inside the build.gradle (app module)
apply plugin: 'com.google.gms.google-services'
Finally added this line to the main/AndroidManifest.xml to the activity section:
android:exported="true"
So I've just had the same problem with the incompatible required and current Gradle versions(followed the suggested AGP update). Going back to v7.0.4 has fixed the issue.
However, the answer given by #Khaled has also worked for me.
File > Invalidate Caches > Invalidate and Restart
You have to update to android studio dolphin first (was on chipmunk).
This update support gradle version : 3.2 to 7.3, link here https://developer.android.com/studio/releases/gradle-plugin
Then update gradle-wrapper.properties :
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
Then update your module dependencies as below
dependencies {
classpath 'com.android.tools.build:gradle:7.3.0'
}
Optional : You will be asked to update gradle plugin to 7.3.1 so you can do it then your will have -> 'com.android.tools.build:gradle:7.3.1'
That's all you need, no invalidate cache and restart or something else.
Install new version Android Studio. It's working for me.

Android Studio App not opening on Physical Device [duplicate]

When I try to render a layout preview in Android Studio I get error:
Unsupported major.minor version 52.0
Check your JAVA_HOME to use jdk 1.8
Also check : the parameter in Android Studio in order to change at
File->Other Settings->Default Project Structure->SDKs
This is bug in Android Studio.
Usually you get error: Unsupported major.minor version 52.0
WORKAROUND: If you have installed Android N, change Android rendering version with older one and the problem will disappear.
SOLUTION: Install Android SDK Tools 25.1.3 (tools) or higher
I've all done, setting JAVA_HOME, JAVA8_HOME, ... and i had always the error.
For me the solution was to set the version 2.1.0 of gradle to work with Jdk 1.8.0_92 and android studio 2.11
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
//classpath 'com.android.tools.build:gradle:2.+'
}
For those of you, who are still facing this.
I got this problem after I upgraded to Android Studio to 2.1.2.
I was stuck at this problem for about an hour, I tried these solutions:
multidexEnabled true
increasing the memory for deamon thread
upgraded to Java 8
I double checked the gradle scripts and found this:
compileSdkVersion 23
buildToolsVersion "24.0.0"
changed to:
compileSdkVersion 23
buildToolsVersion "23.0.3"
I don't know how this caused the error, but this did the trick for me.
Please let me know how this worked if you know the answer.
Thanks
Unsupported major.minor version 52.0
When a higher JDK is used for compilation it creates class file with
higher version and when a lower JDK is used to run the program it
found that higher version of class file not supported at JVM level and
results in java.lang.UnsupportedClassVersionError.
How to fix
Increase the JAVA version you are using to run your program
You can follow some tricks
Call stable version classpath 'com.android.tools.build:gradle:2.1.0' // 2.3.0
Configuring Gradle
To enable the Java 8 language features and Jack for your project, enter the following in your module-level build.gradle file:
android {
...
defaultConfig {
...
jackOptions {
enabled true
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
Courtesy goes to Java 8 Language Features
Just select "API 23: Android 6.0" from preview section .
If you're seeing this error and you just upgraded to Android Studio 2.2+ you need to update your JDK in "Project Structure" options.
On OSX, this is found under File > Project Structure > SDK. Or from the welcome screen in Configure > Project Defaults > Project Structure.
Select the Use the embedded JDK (recommended) option instead of using your own JDK.
Google's docs aren't yet updated to reflect this change. See: http://tools.android.com/tech-docs/configuration/osx-jdk
Im my case I had to change the dependencies of the build.gradle file to:
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
}
(originally was 2.2.2)
I guess this was generated by get several people working in the same project with different versions of gradle. So check your gradle version and edit this file properly.
Good vibes!
With the latest version, you are recommended to switch to the embedded JDK like in the image below, and this will solve your error
I also got the same error message of 'Unsupported major.minor version 52.0' when running ./gradlew makeJar to create a jar library by Android Studio 2.2.3.
After moving down the version of gradle plugin in build.gradle from 2.2.2 to 2.1.3, the error message disappeared and all worked well.
classpath 'com.android.tools.build:gradle:2.1.3'
I don't know how the higer version of gradle plugin caused the error, but this did the trick for me. please let me know how this worked if you know the answer, thanks
1、make sure Gradle Gradle JVM Version
2、make sure ProjectSettings SDKs Veriosn
For me, updating the Android Studio to the latest version solved the problem.
I tried to find solution to this problem.I tried most of the solutions mentioned in this thread. However, I am not very sure why this was occurring. Probably a bug in Android Studio. Anyhow, this is what solved the problem:
In Application level build.gradle,
removed:
classpath 'com.android.tools.build:gradle:2.2.0-beta1'
replaced with:
classpath 'com.android.tools.build:gradle:2.0.0'
This occur due to incompatible java version you are using in android studio and the java version that was used with your imported project.
Go to
File->Project structure->Change jdk 1.7 to jdk 1.8 .After that Go to File->click on Invalidate cache and Restart.
Hope this helps..
And change the dependency classpath in gradle file
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
Changing to Java SDK to Java 8 worked for me.
Android Studio settings: File -> other settings ->Default project structure -> JDK location -> jdk1.8.0_71.jdk/Contents/Home
Make sure to do a clean build after changing a version of Java. As it turns out Android Studio does some work when you switch the JDK but doesn't clean the workspace and creates confusion ¯\_(ツ)_/¯
This error "Unsupported major.minor version 52.0" refers to the java compiler, although the string "major.minor" looks very similar to the Android SDK version format.
On Windows platform, asides updating jdk to 1.8, make sure JAVA_HOME point to where your jdk 1.8 is installed (i.e. C:\Program Files\Java\jdk1.8.0_91).
I had to update Java version to JDK 8 at Jenkins->Manage Jenkins->Global Tool Configuration->JDK.
Changing to Java SDK to Java 8 and worked for me
Android Studio settings:
File > other settings > Default project structure > JDK location > jdk1.8.0_71.jdk/Contents/Home
Android Studio behaves weird in the case. Even though you set the JDK version in File -> Project Structure -> SDK Location, Android Studio only uses this for compiling the files. When it runs these files it, for some reason, looks at the PATH variable to find where java is installed.
If you have an older version of java installed on your system, then your PATH variable will be pointing to that older version of java.
So you have to set your PATH to point to the same version of java that have set in your Android studio project settings.
In your ~/.bashrc or corresponding profile file add this:
export PATH="/Applications/studio.app/Contents/jre/jdk/Contents/Home/bin:$PATH"
In my case my project was configured to use java 1.8, but my system wide installation of java was java 1.7. This was causing the issue.
For my case, my original Android SDK Build-tools version is 24 and Andoid SDK Tools version is 25.1.7. I install Android SDK Build-tools version 23.0.3 by Andoird SDK manager.
Modify these 2 lines to:
buildToolsVersion "23.0.3"
compileSdkVersion 24
Then it works!
Download latest JDK and install. Go toVS2015 Tools > Options > Xamarin and change the java to the latest JDK location
Also, if issue appears while executing ./gradlew command, setting java home in gradle.properties file, solves this issue:
org.gradle.java.home=/usr/java/jdk1.8.0_45/
For me the problem was that the version of gradle in build.gradle was not same as the actual gradle version I had installed.
dependencies {
classpath('com.android.tools.build:grade:2.2.0') {
force = true}
Check your installed gradle versions at /Contents/gradle/m2repository/com/android/tools/build/gradle/
and change the above build.gradle file with
classpath('com.android.tools.build:grade:1.5.1') or <>
I had got the same error and I had JDK 8 set as JAVA_HOME. It turned out that I had Android SDK Build-tools rev 25.0.2 installed. I removed this and installed 23.0.2 instead and it worked for me.
change to
buildToolsVersion "23.0.2" in app gradle file.

Plugin is too old

I know this question isn't new, but I really couldn't find the solution for me.
Im getting the
Plugin is too old, please update to a more recent version, or set
ANDROID_DAILY_OVERRIDE environment variable to
"3915652b2897b86e86ec1d347be9193f1139098e"
error while trying to build the project.
build.gradle classpath:
classpath 'com.android.tools.build:gradle:2.2.0-alpha2'
wrapper:
distributionUrl = https\://services.gradle.org/distributions/gradle-2.10-all.zip
now when I`m using lower version of gradle it builds the project but the instant run isn't working because it requires the alpha2.
any ideas?
Current version of gradle plugin is 2.2.0-alpha4
You can find the name of latest version in the Bintray repository or on the badge in the bottom of the answer :)
[ ![Download] 2]3

Unsupported major.minor version 52.0 when rendering in Android Studio

When I try to render a layout preview in Android Studio I get error:
Unsupported major.minor version 52.0
Check your JAVA_HOME to use jdk 1.8
Also check : the parameter in Android Studio in order to change at
File->Other Settings->Default Project Structure->SDKs
This is bug in Android Studio.
Usually you get error: Unsupported major.minor version 52.0
WORKAROUND: If you have installed Android N, change Android rendering version with older one and the problem will disappear.
SOLUTION: Install Android SDK Tools 25.1.3 (tools) or higher
I've all done, setting JAVA_HOME, JAVA8_HOME, ... and i had always the error.
For me the solution was to set the version 2.1.0 of gradle to work with Jdk 1.8.0_92 and android studio 2.11
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
//classpath 'com.android.tools.build:gradle:2.+'
}
For those of you, who are still facing this.
I got this problem after I upgraded to Android Studio to 2.1.2.
I was stuck at this problem for about an hour, I tried these solutions:
multidexEnabled true
increasing the memory for deamon thread
upgraded to Java 8
I double checked the gradle scripts and found this:
compileSdkVersion 23
buildToolsVersion "24.0.0"
changed to:
compileSdkVersion 23
buildToolsVersion "23.0.3"
I don't know how this caused the error, but this did the trick for me.
Please let me know how this worked if you know the answer.
Thanks
Unsupported major.minor version 52.0
When a higher JDK is used for compilation it creates class file with
higher version and when a lower JDK is used to run the program it
found that higher version of class file not supported at JVM level and
results in java.lang.UnsupportedClassVersionError.
How to fix
Increase the JAVA version you are using to run your program
You can follow some tricks
Call stable version classpath 'com.android.tools.build:gradle:2.1.0' // 2.3.0
Configuring Gradle
To enable the Java 8 language features and Jack for your project, enter the following in your module-level build.gradle file:
android {
...
defaultConfig {
...
jackOptions {
enabled true
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
Courtesy goes to Java 8 Language Features
Just select "API 23: Android 6.0" from preview section .
If you're seeing this error and you just upgraded to Android Studio 2.2+ you need to update your JDK in "Project Structure" options.
On OSX, this is found under File > Project Structure > SDK. Or from the welcome screen in Configure > Project Defaults > Project Structure.
Select the Use the embedded JDK (recommended) option instead of using your own JDK.
Google's docs aren't yet updated to reflect this change. See: http://tools.android.com/tech-docs/configuration/osx-jdk
Im my case I had to change the dependencies of the build.gradle file to:
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
}
(originally was 2.2.2)
I guess this was generated by get several people working in the same project with different versions of gradle. So check your gradle version and edit this file properly.
Good vibes!
With the latest version, you are recommended to switch to the embedded JDK like in the image below, and this will solve your error
I also got the same error message of 'Unsupported major.minor version 52.0' when running ./gradlew makeJar to create a jar library by Android Studio 2.2.3.
After moving down the version of gradle plugin in build.gradle from 2.2.2 to 2.1.3, the error message disappeared and all worked well.
classpath 'com.android.tools.build:gradle:2.1.3'
I don't know how the higer version of gradle plugin caused the error, but this did the trick for me. please let me know how this worked if you know the answer, thanks
1、make sure Gradle Gradle JVM Version
2、make sure ProjectSettings SDKs Veriosn
For me, updating the Android Studio to the latest version solved the problem.
I tried to find solution to this problem.I tried most of the solutions mentioned in this thread. However, I am not very sure why this was occurring. Probably a bug in Android Studio. Anyhow, this is what solved the problem:
In Application level build.gradle,
removed:
classpath 'com.android.tools.build:gradle:2.2.0-beta1'
replaced with:
classpath 'com.android.tools.build:gradle:2.0.0'
This occur due to incompatible java version you are using in android studio and the java version that was used with your imported project.
Go to
File->Project structure->Change jdk 1.7 to jdk 1.8 .After that Go to File->click on Invalidate cache and Restart.
Hope this helps..
And change the dependency classpath in gradle file
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
Changing to Java SDK to Java 8 worked for me.
Android Studio settings: File -> other settings ->Default project structure -> JDK location -> jdk1.8.0_71.jdk/Contents/Home
Make sure to do a clean build after changing a version of Java. As it turns out Android Studio does some work when you switch the JDK but doesn't clean the workspace and creates confusion ¯\_(ツ)_/¯
This error "Unsupported major.minor version 52.0" refers to the java compiler, although the string "major.minor" looks very similar to the Android SDK version format.
On Windows platform, asides updating jdk to 1.8, make sure JAVA_HOME point to where your jdk 1.8 is installed (i.e. C:\Program Files\Java\jdk1.8.0_91).
I had to update Java version to JDK 8 at Jenkins->Manage Jenkins->Global Tool Configuration->JDK.
Changing to Java SDK to Java 8 and worked for me
Android Studio settings:
File > other settings > Default project structure > JDK location > jdk1.8.0_71.jdk/Contents/Home
Android Studio behaves weird in the case. Even though you set the JDK version in File -> Project Structure -> SDK Location, Android Studio only uses this for compiling the files. When it runs these files it, for some reason, looks at the PATH variable to find where java is installed.
If you have an older version of java installed on your system, then your PATH variable will be pointing to that older version of java.
So you have to set your PATH to point to the same version of java that have set in your Android studio project settings.
In your ~/.bashrc or corresponding profile file add this:
export PATH="/Applications/studio.app/Contents/jre/jdk/Contents/Home/bin:$PATH"
In my case my project was configured to use java 1.8, but my system wide installation of java was java 1.7. This was causing the issue.
For my case, my original Android SDK Build-tools version is 24 and Andoid SDK Tools version is 25.1.7. I install Android SDK Build-tools version 23.0.3 by Andoird SDK manager.
Modify these 2 lines to:
buildToolsVersion "23.0.3"
compileSdkVersion 24
Then it works!
Download latest JDK and install. Go toVS2015 Tools > Options > Xamarin and change the java to the latest JDK location
Also, if issue appears while executing ./gradlew command, setting java home in gradle.properties file, solves this issue:
org.gradle.java.home=/usr/java/jdk1.8.0_45/
For me the problem was that the version of gradle in build.gradle was not same as the actual gradle version I had installed.
dependencies {
classpath('com.android.tools.build:grade:2.2.0') {
force = true}
Check your installed gradle versions at /Contents/gradle/m2repository/com/android/tools/build/gradle/
and change the above build.gradle file with
classpath('com.android.tools.build:grade:1.5.1') or <>
I had got the same error and I had JDK 8 set as JAVA_HOME. It turned out that I had Android SDK Build-tools rev 25.0.2 installed. I removed this and installed 23.0.2 instead and it worked for me.
change to
buildToolsVersion "23.0.2" in app gradle file.

How to Get Cordova to Work With Android Studio?

I have the newest everything, node, npm, android studio, cordova.
I created a new project with:
cordova create test
cd test
cordova platform add android
I go into Android Studio, import project, go to test/platforms/android it finds the build.gradle file, works on it for awhile then spits out:
Gradle version 1.10 is required. Current version is 2.2.1
So I go to my build.gradle file, and update the line
dependencies {
classpath 'com.android.tools.build:gradle:0.10.+'
}
to:
dependencies {
classpath 'com.android.tools.build:gradle:0.14.+'
}
And then I re-import my project, it chugs on it for awhile, then spits out:
Error:failed to find Build Tools revision 19.0.0
So I install Build Tools 19.0.0
And it tells me:
Error:The SDK Build Tools revision (19.0.0) is too low for project 'android'. Minimum required is 19.1.0
So I look at my SDK Manager and I have 19.1.0 installed
So I go back into my build.gradle file:
and I change:
buildToolsVersion "19.0.0"
to
buildToolsVersion "19.1.0"
And re-import again,
And still tells me:
Error:The SDK Build Tools revision (19.0.0) is too low for project ':CordovaLib'. Minimum required is 19.1.0
I even try and delete SDK Build Tools revision 19, and keep 19.1 but it still tells me that.
Can anyone that has done this song and dance please help me?
I had exactly the same problem and just fixed it. What you need to do is complete the same buildToolsVersion "19.1.0" change to the build.gradle file in the CordovaLib folder within your platform project folder e.g. platforms/android/CordovaLib.
I solved the problem, modifing gradle file App and gradle file CordovaLib, with the following information:
changed dependencies {
classpath 'com.android.tools.build:gradle:1.1.0+'
}
}
and
android {
compileSdkVersion 19
buildToolsVersion "19.1.0"
}
Tested on Android Studio 1.1
I had same problem. In the end choosing "Import Non-Android Studio project" and navigating to the android folder platforms/android worked. Wasn't sure if you initially choose the "Import Non-Android Studio project" option.
I had the same problem and corrected the content of build.gradle directly in Android Studio (replacing 19.0.0 with 19.1.0). The build was succeful after that. Of course, this is only a workaround until the Cordova team fixes the problem permanently. Good luck.

Categories

Resources