Hello AndroidStudio Users,
Recently I have updated my Android Studio with 2.2 version, No so many Gradle and Instant Run update I got, that I have updated.
But whenever I open a new project, I am getting the following dialog to convert the project.
Is it required to convert? What it will convert actually? Does anyone know?
It just update your build.gradle file for new features of Android Studio.
buildscript
for Android Studio Version 2.1.3
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
to Latest Android Studio Version 2.2
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
Here you would find all changes had been made with - the newest version of Android Studio: http://tools.android.com/recent/androidstudio22andemulator2522arestable
This release is focused on bug fixes, performance, and the following
new features:
Design
Layout Editor
Constraint Layout
Layout Inspector (Experimental)
PSD File Support in Vector Asset Studio
Develop
Firebase Plugin
Updated Code Analysis & Lint checks
Enhanced accessibility support
Improved C++ Support Edit & Debugging
IntelliJ 2016.1.3 platform update
Samples Browser
Improved Font Rendering
Build
Jack Compiler Improvements
Java 8 Language Support
C++ ndk-build or CMake
Merged Manifest Viewer
Build cache (Experimental)
OpenJDK Support
Instant Run Improvements
Test
Espresso Test Recorder (Beta)
APK Analyzer
GPU Debugger (Beta)
Virtual Sensors in the Android Emulator
Check also: http://android-developers.blogspot.com/2016/09/android-studio-2-2.html
As you see there are many changes which force you to talk with your team mates. If they would decide to stick with older version 2.1.3, please unnistall the latest one and the most important: don't convert your project, as you may have issues with opening converted project on older Android Studio version.
The problems I alraedy see are:
- new android sdk version 25.+
- new Gradle plugin version
- constraint-layout
Hope it will help
changed it just an hour back.. you can convert it !!
If you are working on VCs tell your team mate to update sdk 25.2.2 .
Convert the project to new sdk and you gotta feel whole new experience.
Surprise :xml preview has been changed :)
Related
i am using ARFoundation 4.1.0 preview package and in XR plug-in management in unity project settings i have enabled the Arcore but the problem is when i build it gives me "Missing 'package' key attribute on element package at [:arcore_client:] AndroidManifest.xml:30:9-54". and when i disable the Arcore it works fine but i get black screen camera.
I have similar question with you, but I was using ARcore SDK.
This issue happens for the combination of:
Using Android-SDK's API level 31 (or later),
With old Gradle version(s).
Basically, updating build-tools to 31 is not enough to support queries element (of manifest, added since Android 11+). Gradle needs to be updated, too.
I solved it by changing Gradle-plugin in my assets--plugins--android--mainTemplate.gradle file, from 3.4.0 to 3.6.0, like:
dependencies {
classpath 'com.android.tools.build:gradle:3.6.0'
}
you may need to check "Customer Gradle Templete" in player setting-publishing setting-build, to create this file
i solved it by reverting back from ar foundation preview 10 4.1.0 to preview-2
This is due to the gradle file configuration issue. You have to manually make some changes in the custom gradle files in Unity 3D 2019+ versions.
Go to Preferences > External Tools > Android > Gradle, and set the custom Gradle to Gradle 5.6.4 or later. If you are already having it then skip the step.
Go to Project Settings > Player > Android tab > Publishing Settings > Build, and select both:
Custom Main Gradle Template
Custom Launcher Gradle Template.
Apply the following changes to both generated files:
Assets/Plugins/Android/mainTemplate.gradle
Assets/Plugins/Android/launcherTemplate.gradle
If present, remove the following comment at the top of the file:
// GENERATED BY UNITY. REMOVE THIS COMMENT TO PREVENT OVERWRITING WHEN EXPORTING AGAIN
Insert the following lines at the top of the file:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.6.0'
}
}
allprojects {
repositories {
google()
jcenter()
flatDir {
dirs 'libs'
}
}
}
Find the Gradle version that your Unity version uses from here.
Then find the latest Gradle plugin version compatible with the Gradle version found in step one from here.
In the Publishing Settings section in the Player Settings, tick the Custom Gradle Template option. Unity then generates a default mainTemplate.gradle file in Assets/Plugins/Android/ folder.
In the mainTemplate.gradle file, update the com.android.tools.build:gradle plugin version to the newer version found in step 2.
I am using Android Data Binding, and while things were simple it was working very well. However, once I added a BindingAdapter annotation, my project stopped building in Android Studio with an error Execution failed for task ':app:compileSaferesourceDebugJavaWithJavac', but it didn't give me any more detail. Running gradlew build on the command line showed that the actual error was java.lang.ClassNotFoundException: javax.xml.bind.JAXBException. This makes sense, because this development machine has only Java 11 installed, not Java 8.
I found this answer, which says to add the following dependencies to gradle:
implementation "javax.xml.bind:jaxb-api:2.2.11"
implementation "com.sun.xml.bind:jaxb-core:2.2.11"
implementation "com.sun.xml.bind:jaxb-impl:2.2.11"
implementation "javax.activation:activation:1.1.1"
The problem I have is that I don't know where to add them. Adding them as implementation dependencies to the app/build.gradle doesn't work, because JAXB is a dependency of the build tools, not of my application itself.
I tried adding them as buildscript.dependencies too, but that didn't work either:
buildscript {
repositories {
google()
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "javax.xml.bind:jaxb-api:2.3.1"
classpath "com.sun.xml.bind:jaxb-core:2.3.0"
classpath "com.sun.xml.bind:jaxb-impl:2.3.1"
classpath "javax.activation:activation:1.1.1"
}
}
I also tried adding them as buildscript.dependencies in the project root build.gradle file, but that also did not help:
buildscript {
repositories {
google()
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "javax.xml.bind:jaxb-api:2.3.1"
classpath "com.sun.xml.bind:jaxb-core:2.3.0"
classpath "com.sun.xml.bind:jaxb-impl:2.3.1"
classpath "javax.activation:activation:1.1.1"
}
}
I know that I can use Java 8 to build this code, but I really don't want to have to deal with multiple Java versions and I have other projects that require Java 11.
Is there a place in the gradle configuration that I can put these build dependencies to get them to work?
Configurations I tested:
Operating Systems: Tested on Windows 10 and Windows Server 2016
Build Environments: Tested in Android Studio 3.4.1, Android Studio 3.5.0-beta04, and using Gradle Wrapper on the command line
Android Gradle Plugin: tested with 3.4.1 and 3.5.0-beta04
Android Build Tools: tested with 28.0.3 and 29.0.0
Note: comment asks for Databinding version, which is no longer relevant since Databinding is now built-in and does not have a separate version number.
Fail with error show above:
Java 11.0.1 x64
Working properly:
Java 1.8.0_212 x64
After extensive testing, it is clear that the Java version is the only thing that makes any difference here.
UPDATE As of 2020-07-21, the Android bug tracker now states:
Studio will also start using JDK 11 starting in 4.2, approx in 1 to 2 months.
According to a member of the Android Project on the Android Bug Tracker as of 2019-03-07:
Java 11 is not supported by Android studio and its tools.
I've been working on an android app in Android Studio 3.0 canary 6 on another computer and using Github so that I can work on the project from any computer. Unfortunately, 3.0 doesn't scale correctly on my Surface Pro 4, so it is unusable. When I load the project in 2.3, I get an error that says something along the lines of "this gradle version requires Studio 3.0". I have tried tinkering with the gradle version in 2.3, but to no avail. Is it at all possible to totally convert the project for use in 2.3 (permanently; I would have no need to use 3.o again. I was just playing around with it.), and if so, how would I go about doing that? Thank you!
Yes, you can do that.
From 3.0 to 2.3.3 you must do the following changes:
Open your project on the Android Studio 2.3.
Expand Gradle Scripts, open gradle-wrapper.properties file and change the final piece of distributionUrl attribute to /gradle-3.3-all.zip . This may vary depending on your 2.x version.
Next, open build.gradle(Project: YOURPROJECT) and change the classpath inside dependencies {} to 'com.android.tools.build:gradle:2.3.3' . In repositories {} that is inside buildscript {} change google() to maven {url 'https://maven.google.com/' name 'Google' }. You should do this same thing to allprojects {} that is found just below dependencies {}.
Finally, open build.gradle(Module: app) and inside dependencies {} change the word "implementation" to "compile". Now sync your Gradle.
These changes will make the error you found, regarding the IDE version, to stop showing. You'll probably have other errors popping up that are related to sdk and dependencies versions. Just adjust the versioning of the sdk and dependencies to the ones that are used by your Android Studio 2.3. Some XML files may also show errors and you must manually correct those.
enter image description here
I have buy new macbook and I download android studio when I start new project its stock in build ..... Gradle project info
android studio last version 2.3
I try gradle work offline in setting and the same
OS X 10.9.5
java 1.8 (121)
android studio only show Building My Application Gradle project info
Thank you
According to this you may just be experiencing a slow network connection. WHen a project is created for the first time there is a lot to be downloaded, and it can take a while on slow connections.
ACcording to this you may be using the wrong version of android studio. If you navigate to the folder where you have Android Studio's files, look for "studio.exe" and "studio64.exe". First though, close the current open Android Studio window. Start by selecting "studio64" and opening it. Create a new project and see if it gets stuck. If it gets stuck, try with "studio.exe" and create the project again. If it gets stuck agian, try a different solution.
And according to this you could try pressing "cancel" and finding your build.gradle on project-level. IN there you will find something like this:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
Replace 2.3.0 with an earlier version, e.g. 2.0.0. Then press (in the menu bar at the top) build>make project. Gradle will start to build should in theory finish.
If none of these work, leave a comment so I know and can look for other alternatives to these
I didn’t work full-time with Android in the last couple of years, and now whenever I try to fork someone code on GitHub I get a lot of errors since android tools and Gradle syntax are changing frequently.
I wonder what is the best way to handle these changes, and be able to upgrade other GitHub projects and some of my old projects to work with the latest Android tools. Here are some of the things that I struggle with:
I noticed some of the issues are related to changes in the Gradle syntax. How can I know what Gradle version the build.grade syntax was written with? and then how to upgrade it to the current version (is there a migration guide for Gradle versions?).
Sometimes I get issues related to tools that are not compatible with others, how can I know which version are compatible with which? and whats the easy way to manage that? here are some of these tools:
Gradle
Android Plugin for Gradle
Build Tools
Android Studio
How can I know what Gradle version the build.grade syntax was written with?
If the project contains a gradle/wrapper/gradle-wrapper.properties file, that is the version of Gradle that the developer of the project is using.
is there a migration guide for Gradle versions?
I am not aware of much Gradle syntax that would have changed that would affect Android developers for garden-variety projects. Most of the changes are from the DSL added via the Gradle for Android plugin. You can find the version of the plugin that the project developer was using via the classpath statement in the project's top-level build.gradle file.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
}
}
The above snippet is requesting version 1.3.0 of the Gradle for Android plugin.
Migration documentation for the Gradle for Android plugin is minimal. What there is can be found up on http://tools.android.com.
how can I know which version are compatible with which?
Here is Google's statement on the issue, though this has not been updated in a few months.
and whats the easy way to manage that?
If the tools complain, change them to a set that you know is good (e.g., by copying values from a known-working project). If you need something that was introduced in a newer version of the tools, change them to a set that you know is good. Otherwise, don't worry about them.