Work on Android Studio 3.0 project on 2.3 - android

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.

Related

Unity Build Error: Missing 'package' key attribute on element package at [:arcore_client:] AndroidManifest.xml:30:9-54

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.

How to run "Watchface for wearos" codelab?

I am new to Android and WearOS and also to Gradle, and I just want to follow along this Codelab:
https://codelabs.developers.google.com/codelabs/watchface/index.html#0
So I downloaded Android Studio and imported the project
https://github.com/googlecodelabs/watchface
but when compiling I just get the error
Failed to resolve: com.google.android.support:wearable:2.0.0
I already tried to change SDK Versions and other things, but it didn't help.
I'm pretty sure it's just a few version settings, but I have no idea where to look.
Did anyone maybe complete this codelab and made it run with the "actual" version of AndroidStudio?
thanks,
Thorsten
The code on github was last updated in May 2017, which is a shame, as it is a useful introduction to watchfaces. A number of things have changed since then. There is even a pull request on github with gradle updates from Nov 2018, but it hasn't been merged.
Your 'Failed to resolve' error is likely related to Google now providing some packages in their own Maven repository, in addition to jcenter.
This can be fixed by adding google() to the repositories closures in the Package build.gradle file:
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.0.2'
}
}
allprojects {
repositories {
jcenter()
google()
}
}
The version of the gradle plugin has been changed to 4.0.2 above too, so also update the file gradle-wrapper.properties with:
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
Gradle should now build, but it may still log some warnings or errors in the Build window which you can open at the bottom of Android Studio.
The gradle dependency keyword 'provided' has been replaced with 'compileOnly' and 'compile' with 'implementation'. Shift+Ctrl+R in Android Studio will enable you to easily do the replacement project-wide.
It should also be useful for updating compileSdkVersion and targetSdkVersion (to 30) and buildToolsVersion (to 30.0.2) in all the module build.gradle files.
The package versions are out of date, with the wearable ones currently at 2.8.1 and play-services-wearable at 17.0.0. Ctrl+Alt+Shift+S takes you to 'Suggestions' in 'Project Structure', which can help you in future to stay current.
The last problem is that the Android Support Library has been obsoleted in favor of jetpack/androidx. See the old reference.
In this project, it is only a problem in the build.gradle of module 5-palette. You may replace 'com.android.support:palette-v7:23.3.0' with 'androidx.palette:palette:1.0.0'. See Jetpack Artifact Mappings. You then need to change the import statement in MyWatchFaceService.java.
Finally add the following line to gradle.properties:
android.useAndroidX=true

Trouble trying to build app with Jenkins and latest android plugin 3.0.0-alpha8

I have the Android studio 3.0 Canary preview and am able to build fine there. When I try to build on jenkins with gradlew I receive
Could not find com.android.databinding:baseLibrary:3.0.0-alpha8.
I thought maybe the google() repo wasn't working but you'd think that would error out itself so I replaced
google()
with
maven { url 'https://maven.google.com' }
and I still get the same error. The only reference that I have in my build.gradle for databinding is
android {
dataBinding.enabled = true
}
my gradle wrapper has a distribution url of
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-milestone-1-all.zip
does anyone have an Idea of what I'm doing wrong or let me know if you need more information.
Same error here.
It's because you use Android Studio Canary Version.
Build Tools are include in package directly:
android-studio\gradle\m2repository\com\android\tools\build\gradle\3.0.0-alpha9
Are you sure that version exists? Looking here it seems like it doesn't.
Keep in mind that 3.0.0-alpha8 (alpha9 as of now) is for classpath 'com.android.tools.build:gradle', and not necessarily other dependencies
You can use the local gradle like this:

Gradle stock on build ***** gradle project info

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

Convert Project after Android Studio 2.2 update

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 :)

Categories

Resources