Android Studio 4 Complete Offline Setup - java

I am trying to setup Android Studio For Offline builds, using latest gradle.
System - Windows 10 64 Bit.
What i have done so far?
Downloaded and Installed Android Studio 4.0.1 Windows 64 Bit from official website. Android SDK and AVD also selected during installation. (Internet Install)
Downloaded Offline components.
Android Gradle Plugin.
Google Maven Dependencies.
From -https://developer.android.com/studio#downloads
And setup according to docs for offline setup.
Downloaded Latest Complete Gradle zip file from :
https://gradle.org/releases.
Gradle version 6.5.1 (gradle-6.5.1-all.zip)
Pasted Gradle zip into .gradle/wrapper/dists/
And extracted it their.
And changed the path From File-> Settings->Build Tools->Gradle to above extracted folder.
When i tried to build, i got following errors:
Could not find com.android.tools.build:gradle:4.0.1 Searched in the following locations: - file:/C:/Users/Xevns/.android/manual-offline-m2/gmaven_stable/.../gradle-4.0.1.pom
Once inspected the offline components achieve, i think it uses Old Android Gradle plugin v3.5.0 beta and Old maven dependecy. But in project its using Gradle plugin 4.0.1 and Gradle 6.5.1.
Please help, where find it latest and setup.

The so called: latest versions of the Android Gradle plugin link does not contain the latest version. You have to select one that is in that package:
Grandle Scripts -> build.grandle :
classpath 'com.android.tools.build:gradle:3.4.0'
The Android Grandle Plugin package does not contain library versions that are needed for that "tools.build:grandle" version - (download manualy from repos?)
Other dependencies (appcompat,constraint-layout, ...) the same problem, requested versions are not included in downloaded Google Maven package.

Related

required plugin "org.jetbrains.idea.maven" not installed

I am using Android Studio 3.5.3 , i dont see any option for MAVEN project and i have tried installing couple of plugins after surfing over net. but still no luck.
I get below error :
Plugin Error
Problems found loading plugins:
Plugin "Maven Runner" was not loaded: required plugin "org.jetbrains.idea.maven" not installed.
I dont see Maven option. only gradel is available
Android Studio image 1
even here i dont see maven
Android Studio image 2

Could not resolve all files for configuration ':app:androidApis'

CONFIGURE SUCCESSFUL in 1s
Calling mockable JAR artifact transform to create file: C:\Users...gradle\caches\transforms-1\files-1.1\android.jar\637e2bccbff6bd0f7a7583f7e9d4551b\android.jar with input C:\Users...\AppData\Local\Android\Sdk\platforms\android-28\android.jar
Gradle sync failed: Could not resolve all files for configuration ':app:androidApis'.
Failed to transform file 'android.jar' to match attributes {artifactType=android-mockable-jar, returnDefaultValues=false} using transform MockableJarTransform
Cannot create mockable android.jar
zip file is empty
I am new to android studio. I have tried all the answers I could get none worked.
I changed my gradle plugin to 3.1.1 and lower is still the same thing.
I have clean build and invalidate cache/reset.
Do I have to install a lower android studio. Why is this happening for a new project?
Andriod studio 3.2.1
#Openwell thanks a lot. you save my day!
I found the source of the problem. I noticed that the andriod.jar file in C:\Users**\AppData\Local\Android\Sdk\platforms\android-28 was missing, the file was 0kb. which shouldn't be so. So I reinstalled the Android SDK platform and sources by uninstalling it from SDK Manager and installed it back. then the problem was solved.
I just changed the compiled version to API level to which I have downloaded in the SDK Manager. For me in File=>Project Structure, the compiled version is set to 29 which I haven't downloaded SDK. So I changed it to 28 which I have downloaded.Then it worked.
After upgrading AndroidStudio version to 4.1, also upgraded Android Gradle plugin to 4.1.0.
But in Project root folder build.gradle file, In dependencies, it has this below gradle classpath for com.google.gms:google-services version as 4.3.0. Caused the issue.
dependencies {
classpath 'com.android.tools.build:gradle:4.1.0'
classpath 'com.google.gms:google-services:4.3.0'
}
after upgrading com.google.gms:google-services to latest version, and Sync project.
dependencies {
classpath 'com.android.tools.build:gradle:4.1.0'
classpath 'com.google.gms:google-services:4.3.4'
}
Solved the issue.

gradle build error when building android project

I am trying to build a simple android project on the command line using
android create project
I am following this tutorial, and using android-sdk tools version 25.2.5 which still includes the above command. However, my gradle version is 4.8.1 and java 10.0.1.
First, I cd into my project folder and use the android command to create a project:
android create project -p . -a MainActivity -k com.test.firstapp -t "android-22" -g -v 2.3.0
This gives me a project frame. I chose the android gradle plugin version 2.3.0 based on this web page, hoping it would support all newer versions of gradle as well.
Then I try to build the project with
./gradlew build
and get my first error:
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine java version from '10.0.1'.
So I reckoned there must be a mismatch with the gradle version and the gradle plugin version I am using because gradle 4.8.1 should definitely support java 10.0.1. I then went and looked at my build.gradle file in the project directory and changed the android plugin version to 3.1.0, as follows:
classpath 'com.android.tools.build:gradle:3.1.0'
also adding google() to the repositories. I still got the same java version error. Now, I had a look at gradle/wrapper/gradle-wrapper.properties and saw that the distributionUrl was for gradle 1.12, so I changed it to my actual version:
distributionUrl=http\://services.gradle.org/distributions/gradle-4.8.1-all.zip
After changing the gradle version in the wrapper, I call:
gradle wrapper --gradle-version 4.8.1
as advised here. Running this, I first get a warning and and error:
Configure project :
WARNING: The specified Android SDK Build Tools version (22.0.1)
is ignored, as it is below the minimum supported version (27.0.3) for Android Gradle Plugin 3.1.0.
Android SDK Build Tools 27.0.3 will be used.
To suppress this warning, remove "buildToolsVersion '22.0.1'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.
File /home/user/.android/repositories.cfg could not be loaded.
Checking the license for package Android SDK Build-Tools 27.0.3 in /opt/android-sdk/licenses
License for package Android SDK Build-Tools 27.0.3 accepted.
Preparing "Install Android SDK Build-Tools 27.0.3 (revision: 27.0.3)".
Warning: Failed to read or create install properties file.
Project evaluation failed including an error in afterEvaluate {}. Run with --stacktrace for details of the afterEvaluate {} error.
FAILURE: Build failed with an exception.
* Where:
Build file '/home/user/dev/android/firstapp/build.gradle' line: 18
* What went wrong:
A problem occurred evaluating root project 'firstapp'.
> Could not find method runProguard() for arguments [false] on BuildType_Decorated{name=release, debuggable=false, testCoverageEnabled=false, jniDebuggable=false, pseudoLocalesEnabled=false, renderscriptDebuggable=false, renderscriptOptimLevel=3, minifyEnabled=false, zipAlignEnabled=true, signingConfig=null, embedMicroApp=true, mBuildConfigFields={}, mResValues={}, mProguardFiles=[], mConsumerProguardFiles=[], mManifestPlaceholders={}} of type com.android.build.gradle.internal.dsl.BuildType.
I'm sure it's a mismatch of versions but could someone point out what the right combination is if I want to keep working with android-sdk tools 25.2.5?
I'm doing this on Ubuntu 16.04.
Thanks.
In the end, the combination that works for me was the following:
android sdk tools 25.2.5
android build tools 26.0.2
platform-tools 28.0.0 (uncritical in any case...)
java 8 (indeed had to downgrade)
gradle 4.8.1
android gradle plugin 3.0.1
With this combination I was able to create a project using 'android create project' and build with './gradlew build':
> android create project -p . -a MainActivity -k com.test.firstapp -t "android-22" -g -v 3.0.1
> Created directory ....
The android tool still creates some deprecated input into build.gradle, such as proguard instead of minifyEnabled, and leaves out some repositories (google(), jcenter()) that I need to find the newer gradle plugin version, among other things. Also, the gradle-wrapper.properties sill contain an outdated gradle version url but that can be changed as shown in my original question. I'm a lot closer to automating project creation from the command line than before even if it's not perfect.

Gradle Sync Failed in Android Studio 3.1.2

How to Solve this error I amm using Android Studio Version 3.1.2
My Build tool is 27.1.1 and I also download the build tool 21.1 for the Project in which I am working:
You need to upgrade your Gradle version.
Edit the file as shown in the images.
See the official Google plugin page

Gradle sync failed version does not support the ModelBuilder API while version is 3.3

I'm fairly new to android development, all of a sudden I'm receiving the following
error:The version of Gradle you are using (Gradle distribution 'https://services.gradle.org/distributions/gradle-3.3-all.zip') does not support the ModelBuilder API. Support for this is available in Gradle 1.2 and all later versions
Which is strange because my current version is 3.3 and higher then gradle 1.2
I have tried reinstalling android studio and pointing to my local gradle distribution through File --> Settings --> Build, Execution, Deployment --> Use Local Gradle Distribution: C:\Users\username\.gradle\wrapper\dists\gradle-3.3-all\RandomCharacters\gradle-3.3
While trying to point to the local distribution I get a message which says the following: Gradle location is incorrect
I meet the same problem you have.But I ignored that ,then load the project manual reopen the project from local...After that,press VCS->Enable Version Control...then connect

Categories

Resources