How to manually install App Engine in Android Studio?

I just added the App Engine module to my application and after synchronization, gradle started loading the App Engine zip server from maven. The App Engine zip file is about 150 MB +, and using maven to download it automatically is very slow, so I decided to manually download appengine java sdk (appengine-java-sdk-1.9.6.zip) and manually install it. I have a zip now, but where can I place it so that Android Studio (0.8.1) picks it up and installs instead of downloading it from the maven repository?

Thanks!

+6
source share
3 answers

The application templates that come with android studio download the appdine sdk application by default ... so if you use these templates, you should do the following.

edit the build.gradle file and delete

dependencies { appengineSdk "com.google.appengine:appengine-java-sdk:XXX" <--- remove ... } 

and

 appengine { downloadSdk = true <--- remove this line as it tells it to dl the sdk } 

You can then reference the loaded sdk using the system property. Create a file in the same directory as your build.gradle file in the appengine module

gradle.properties

 systemProp.appengine.sdk.root = "path to appengine sdk" 

There are other ways to specify the sdk location (e.g. using an environment variable) that may work better for you, check https://github.com/GoogleCloudPlatform/gradle-appengine-plugin

+4
source

A completely different approach is to create a local maven repository for appengine sdk and a link that directly and leave everything else intact.

 repositories { maven { url 'file://path/to/myCustomRepo' } mavenCentral() } 

Thus, this method is easiest if you grab appengine sdk directly from maven.org, because it will be correctly named. ( http://search.maven.org/#artifactdetails|com.google.appengine|appengine-java-sdk|1.9.6|zip ), but select the version that you reference in the assembly file.

About maven repo, you need to configure it correctly. If your downloaded zip is located in /path/to/myCustomRepo , you need to put the zip in the right place: /path/to/myCustomRepo/com/google/appengine/appengine-java-sdk/1.9.6 depending on the version number you are using .

If you only have a zip file in the repository directory, you need to change the downloadSdk line to indicate that everything is available, this is a “zip” with @zip .

 downloadSdk "com.google.appengine:appengine-java-sdk: 1.9.6@zip " 

If you do not want to use @zip , you can add a simple .pom file (next to .zip) so that the system can correctly identify the link

AppEngine-Java-KFOR-1.9.6.pom

 <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.google.appengine</groupId> <artifactId>appengine-java-sdk</artifactId> <packaging>zip</packaging> <version>1.9.6</version> </project> 
+1
source

Another solution, SOLVED!

Set the path to the SDK of the application engine in a file named gradle.properties:

systemProp.appengine.sdk.root=C:/<PATH UNTIL BEFORE OF THE FOLDER APP_ENGINE_SDK>/appengine-java-sdk-1.9.40

Example:

systemProp.appengine.sdk.root=C:/Users/programmer/StudioProjects/MyApplication/.gradle/appengine-java-sdk-1.9.40

Edit the build.gradle file and change the following line to false:

appengine { downloadSdk = false }

0
source

Source: https://habr.com/ru/post/971513/


All Articles