Gradle gets error when try to paste aidl in package - android

I try to use inapp order aidl (IInAppBillingService.aidl).when i copy this in (com.android.vending.billing) package it gets error :
i found some article thats here .
but i dont have Buildtools version 22.1.2 in my OpenMuduleSetting like above article.
how can i solve this problem ?

According to this SO issue:
This bug happens when the versions of SDK, Build Tools and Gradle
Plugins doesn't match (in terms of compatibility). The solutions is
verify if you is using the latest versions of them. The gradle plugins
are placed in the build.gradle of the project, and the other versions
are on the build.gradle of the module. For example, for SDK 23, you
must use the Build Tools 23.0.1 and gradle plugins version 1.3.1.
You're using already newer 23.0.3 build tools so please check if your Gradle plugin is at least in '1.3.0' version
Try to use classpath 'com.android.tools.build:gradle:1.5.1'

Related

How can I downgrade the Gradle in NativeScript?

In my NativeScript project, after the last Gradle update, I can't build a new Bundle file (for Android release). This error is about the compatibility of some plugins with the new Gradle version.
I think if I could downgrade the Gradle version to the previous one, the build will succeed.
Is any way that I could do the Grandle downgrade on a NativeScript project?
Looks like there is a way to specify the version of gradle to use in the project itself. But it is not documented anywhere.
I found these references in their code repository on github:
https://github.com/NativeScript/nativescript-cli/search?q=runtimeGradleVersion
However, it is easy to set gradle version outside the project in gradle.properties file.
Linux
On typical Linux(Debian) nodejs|npm installation, the location of this file is:
/usr/local/lib/node_modules/nativescript/vendor/gradle-plugin/gradle/wrapper/gradle-wrapper.properties
For example, if you wish to specify the version 6.4 of gradle, simply change the line from:
distributionUrl=https\://services.gradle.org/distributions/gradle-{{runtimeGradleVersion}}-bin.zip
to
distributionUrl=https\://services.gradle.org/distributions/gradle-6.4-bin.zip
Windows
The location of the file shall be under:
C:\Users\<username>\AppData\Roaming\npm\nativescript\vendor\gradle-plugin\gradle\wrapper\gradle-wrapper.properties

React Native: What's the difference between gradle references in gradle-wrapper.properties and build.gradle?

In my React Native app, I got an error about incompatibilities with gradle 6, so I looked in my project structure to find out which version of gradle I was running in my project. I found this line in gradle-wrapper.properties
distributionUrl=https\://services.gradle.org/distributions/gradle-5.5-all.zip
and this line in build.gradle
classpath("com.android.tools.build:gradle:3.4.2")
What I Want To Know: What's the difference between the reference to gradle in each of these files? In other words, how is version 5.5 being used in my project, and how is 3.4.2 being used?
distributionUrl represents Gradel Version where as classpath represents Android Gradle plugin version.
Gradel vs Android Gradle plugin: Reffer this difference between android gradle plugin and gradle
Gradle is the build system.
You can use it with a lot of plugins. One of these is the plugin for Android.
It is used to provide processes and configurable settings that are specific to building and testing Android applications.
For greater details and mapping of the above two type of versions refer the following URLs
https://developer.android.com/studio/releases/gradle-plugin#updating-gradle
https://developer.android.com/studio/releases/gradle-plugin#updating-plugin
I hope this answer has cleared your doubts.

How can I fix "unexpected element <queries> found in <manifest>" error?

All of a sudden, I am getting this build error in my Android project:
unexpected element <queries> found in <manifest>
How do I fix it?
The Android Gradle Plugin needs to know about new manifest elements, particularly
for the manifest merger process. The plugin has a tendency to get confused if it
sees elements in the manifest merger that it does not recognize, tossing out
build errors like the one in the question.
In this case, Android 11 introduced <queries> as a manifest element, and older versions of the Android Gradle Plugin do not know about that element.
The fact that this occurs from manifest merger means that simply upgrading a dependency
might bring about this error. For example, if you upgrade to the latest
version of com.awesome:awesome-library, and it contained a <queries> element
in its manifest, you might crash with the aforementioned error in your builds,
even without any other changes in your code.
Google released a series of patch versions of the Android Gradle Plugin to address this:
3.3.3
3.4.3
3.5.4
3.6.4
4.0.1
If you are using an existing plugin in the 3.3.* through 4.0.* series, upgrade
to the associated patch version (or higher) from that list, and you should no longer
run into that error (e.g., classpath 'com.android.tools.build:gradle:4.0.1').
If you are using Android Studio 4.1 or higher, with a matching
Android Gradle Plugin (e.g., in the 4.1.* series), you should be fine without
any changes. Those plugin versions were already aware of <queries>.
See this Android Developers Blog post for more.
I had this issue in Flutter, but I believe this solution will work for both Flutter and native Flutter development.
Follow these steps
Read this short blog post to get some understanding: Preparing your Gradle build for package visibility in Android 11
Delete the .gradle folder inside the Android folder, i.e., android > .gradle
In the project build.gradle file, upgrade your class path appropriately based on the blog in the link above, e.g., I upgraded to classpath 'com.android.tools.build:gradle:4.0.1'
Upgrade the distribution URL too. It's in android>gradle>gradle-wrapper.properties file appropriately. E.g., I upgraded it to distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
You can invalidate caches and restart your Android Studio. Make sure you have a good Internet connection, because it will download the new Gradle files.
I also suddenly had the same issue two days ago in Android Studio 4.1.1. I solved the issue by upgrading the build Gradle version.
Previous setting in the build.gradle file of the project was:
classpath("com.android.tools.build:gradle:3.5.3")
Current setting:
classpath("com.android.tools.build:gradle:3.5.4")
The issue was gone immediately. :)
Fixing the error is very simple.
Update your Android Studio to the last version
and use the last stable Gradle plugin version.
At the current time, I use Android Studio version 4.1.3 with Gradle Plugin 6.8.2
For use in queries, you should write queries code in out of application tag, not inside application tag.
For more information, see the photo below:
I had this error in the react-native-image-crop-picker library, and I solved this problem by updating the Gradle version as mentioned in previous answers.
It was:
classpath("com.android.tools.build:gradle:3.5.3")
Updated to:
classpath("com.android.tools.build:gradle:3.5.4")
And I ran a:
cd android && ./gradlew clean && cd .. && npx react-native run-android
Then it worked OK.
Due to the new default settings and features for package visibility in Android 11 that need to add <queries>, you must update your Android Gradle plugin.
Google has added some patches to current versions listed in Android Gradle plugin release notes, 4.0.0 (April 2020).
If you want to use a newer version of Android Gradle, you should search for a compatible wrapper from Android Gradle plugin release notes, Update Gradle.
Update your Gradle version to 4.0.1 or later.
File android/gradle/wrapper/gradle-wrapper.properties: update the distribution URL to:
distributionUrl=https://services.gradle.org/distributions/gradle-6.7-all.zip
File android/build.gradle: update the Gradle plugin:
classpath 'com.android.tools.build:gradle:4.1.2'
to 4.0.1 or later. Here it is 4.1.2 with Gradle version to 6.5 or later.
You can see the distribution chart at How to update gradle in android studio?

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.

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.

Categories

Resources