Ubuntu environment configuration Summary: (7) Configure AndroidStudio and androidstudio
1. The gradle download fails when a new project is built.
When creating a new project, you are prompted to keep downloading gradle, but the download is not successful.
1) First, go to gradle's official website to download the compressed package.
Http://www.gradle.org/downloads
Gradle-1.12-all.zip
2. Copy the downloaded gradle-1.12-all.zip file ~ /. Gradle/wrapper/dists/gradle-1.12-all/2apkk7d25miau1_1pdjp1bm0uo
Note: If a new project has been created with AS, AS will automatically create this directory.
3) re-open the AS and wait for the AS to automatically complete the gradle configuration.
The following figure shows the working days of the role. First, the role will decompress gradle-1.12-all.zip and then download some dependent jar files.
Unzipping /home/kaizen/.gradle/wrapper/dists/gradle-1.12-all/2apkk7d25miauqf1pdjp1bm0uo/gradle-1.12-all.zip to /home/kaizen/.gradle/wrapper/dists/gradle-1.12-all/2apkk7d25miauqf1pdjp1bm0uoSet executable permissions for: /home/kaizen/.gradle/wrapper/dists/gradle-1.12-all/2apkk7d25miauqf1pdjp1bm0uo/gradle-1.12/bin/gradle16:14:10.417 [Connection worker] DEBUG o.g.t.i.provider.DefaultConnection - Tooling API provider 1.12 created.16:14:10.724 [Connection worker] DEBUG o.g.t.i.provider.ProviderConnection - Configuring logging to level: INFOTooling API is using target Gradle version: 1.12.Could not determine classpath for class org.gradle.util.GradleVersionCould not determine classpath for class org.slf4j.LoggerFactoryStarting Gradle daemonStarting daemon process: workingDir = /home/kaizen/.gradle/daemon/1.12, daemonArgs: [/home/kaizen/developer/jdk1.6.0_45/bin/java, -XX:MaxPermSize=256m, -XX:+HeapDumpOnOutOfMemoryError, -Xmx1024m, -Dfile.encoding=UTF-8, -cp, /home/kaizen/.gradle/wrapper/dists/gradle-1.12-all/2apkk7d25miauqf1pdjp1bm0uo/gradle-1.12/lib/gradle-launcher-1.12.jar, org.gradle.launcher.daemon.bootstrap.GradleDaemon, 1.12, /home/kaizen/.gradle/daemon, 10800000, 57c7e4ac-85a2-40cd-92ea-79aed2105b46, -XX:MaxPermSize=256m, -XX:+HeapDumpOnOutOfMemoryError, -Xmx1024m, -Dfile.encoding=UTF-8]Starting process 'Gradle build daemon'. Working directory: /home/kaizen/.gradle/daemon/1.12 Command: /home/kaizen/developer/jdk1.6.0_45/bin/java -XX:MaxPermSize=256m -XX:+HeapDumpOnOutOfMemoryError -Xmx1024m -Dfile.encoding=UTF-8 -cp /home/kaizen/.gradle/wrapper/dists/gradle-1.12-all/2apkk7d25miauqf1pdjp1bm0uo/gradle-1.12/lib/gradle-launcher-1.12.jar org.gradle.launcher.daemon.bootstrap.GradleDaemon 1.12 /home/kaizen/.gradle/daemon 10800000 57c7e4ac-85a2-40cd-92ea-79aed2105b46 -XX:MaxPermSize=256m -XX:+HeapDumpOnOutOfMemoryError -Xmx1024m -Dfile.encoding=UTF-8Successfully started process 'Gradle build daemon'An attempt to start the daemon took 0.662 secs.Connected to the daemon. Dispatching Build{id=9b20f5b5-b8e0-4861-846e-f33d4ded552f.1, currentDir=/home/kaizen/AndroidStudioProjects/MyApplication} request.Download http://jcenter.bintray.com/com/android/tools/build/gradle/0.12.2/gradle-0.12.2.pomDownload http://jcenter.bintray.com/com/android/tools/lint/lint/23.0.2/lint-23.0.2.pomDownload http://jcenter.bintray.com/com/android/tools/build/builder/0.12.2/builder-0.12.2.pomDownload http://jcenter.bintray.com/com/android/tools/lint/lint-checks/23.0.2/lint-checks-23.0.2.pomDownload http://jcenter.bintray.com/com/android/tools/sdk-common/23.0.2/sdk-common-23.0.2.pomDownload http://jcenter.bintray.com/com/android/tools/build/builder-model/0.12.2/builder-model-0.12.2.pomDownload http://jcenter.bintray.com/com/android/tools/ddms/ddmlib/23.0.2/ddmlib-23.0.2.pomDownload http://jcenter.bintray.com/com/android/tools/build/manifest-merger/23.0.2/manifest-merger-23.0.2.pomDownload http://jcenter.bintray.com/com/android/tools/sdklib/23.0.2/sdklib-23.0.2.pomDownload http://jcenter.bintray.com/com/android/tools/common/23.0.2/common-23.0.2.pomDownload http://jcenter.bintray.com/com/android/tools/build/builder-test-api/0.12.2/builder-test-api-0.12.2.pomDownload http://jcenter.bintray.com/com/android/tools/lint/lint-api/23.0.2/lint-api-23.0.2.pomDownload http://jcenter.bintray.com/com/android/tools/layoutlib/layoutlib-api/23.0.2/layoutlib-api-23.0.2.pomDownload http://jcenter.bintray.com/com/android/tools/dvlib/23.0.2/dvlib-23.0.2.pomDownload http://jcenter.bintray.com/com/android/tools/build/gradle/0.12.2/gradle-0.12.2.jar[ 243945] WARN - api.vfs.impl.local.FileWatcher - Watcher terminated with exit code 0 kaizen@tuan800-inc:~/professional/android-studio/bin$ kaizen@tuan800-inc:~/professional/android-studio/bin$ kaizen@tuan800-inc:~/professional/android-studio/bin$ ./studio.sh Fontconfig warning: "/etc/fonts/conf.d/50-user.conf", line 9: reading configurations from ~/.fonts.conf is deprecated.Fontconfig warning: "/etc/fonts/conf.d/50-user.conf", line 9: reading configurations from ~/.fonts.conf is deprecated.SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".SLF4J: Defaulting to no-operation (NOP) logger implementationSLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.Unzipping /home/kaizen/.gradle/wrapper/dists/gradle-1.12-all/2apkk7d25miauqf1pdjp1bm0uo/gradle-1.12-all.zip to /home/kaizen/.gradle/wrapper/dists/gradle-1.12-all/2apkk7d25miauqf1pdjp1bm0uoSet executable permissions for: /home/kaizen/.gradle/wrapper/dists/gradle-1.12-all/2apkk7d25miauqf1pdjp1bm0uo/gradle-1.12/bin/gradle16:28:28.487 [Connection worker] DEBUG o.g.t.i.provider.DefaultConnection - Tooling API provider 1.12 created.16:28:28.762 [Connection worker] DEBUG o.g.t.i.provider.ProviderConnection - Configuring logging to level: INFOTooling API is using target Gradle version: 1.12.Could not determine classpath for class org.gradle.util.GradleVersionCould not determine classpath for class org.slf4j.LoggerFactoryStarting Gradle daemonStarting daemon process: workingDir = /home/kaizen/.gradle/daemon/1.12, daemonArgs: [/home/kaizen/developer/jdk1.6.0_45/bin/java, -XX:MaxPermSize=256m, -XX:+HeapDumpOnOutOfMemoryError, -Xmx1024m, -Dfile.encoding=UTF-8, -cp, /home/kaizen/.gradle/wrapper/dists/gradle-1.12-all/2apkk7d25miauqf1pdjp1bm0uo/gradle-1.12/lib/gradle-launcher-1.12.jar, org.gradle.launcher.daemon.bootstrap.GradleDaemon, 1.12, /home/kaizen/.gradle/daemon, 10800000, b97e7dd0-c6d2-45f6-bb26-3598cdac5ec3, -XX:MaxPermSize=256m, -XX:+HeapDumpOnOutOfMemoryError, -Xmx1024m, -Dfile.encoding=UTF-8]Starting process 'Gradle build daemon'. Working directory: /home/kaizen/.gradle/daemon/1.12 Command: /home/kaizen/developer/jdk1.6.0_45/bin/java -XX:MaxPermSize=256m -XX:+HeapDumpOnOutOfMemoryError -Xmx1024m -Dfile.encoding=UTF-8 -cp /home/kaizen/.gradle/wrapper/dists/gradle-1.12-all/2apkk7d25miauqf1pdjp1bm0uo/gradle-1.12/lib/gradle-launcher-1.12.jar org.gradle.launcher.daemon.bootstrap.GradleDaemon 1.12 /home/kaizen/.gradle/daemon 10800000 b97e7dd0-c6d2-45f6-bb26-3598cdac5ec3 -XX:MaxPermSize=256m -XX:+HeapDumpOnOutOfMemoryError -Xmx1024m -Dfile.encoding=UTF-8Successfully started process 'Gradle build daemon'An attempt to start the daemon took 0.647 secs.Connected to the daemon. Dispatching Build{id=23bf2872-969b-4499-a311-e96b50cf9695.1, currentDir=/home/kaizen/AndroidStudioProjects/MyApplication} request.Download http://jcenter.bintray.com/com/android/tools/build/gradle/0.12.2/gradle-0.12.2.jarDownload http://jcenter.bintray.com/com/android/tools/lint/lint/23.0.2/lint-23.0.2.jarDownload http://jcenter.bintray.com/com/android/tools/build/builder/0.12.2/builder-0.12.2.jarDownload http://jcenter.bintray.com/com/android/tools/lint/lint-checks/23.0.2/lint-checks-23.0.2.jarDownload http://jcenter.bintray.com/com/android/tools/sdk-common/23.0.2/sdk-common-23.0.2.jarDownload http://jcenter.bintray.com/com/android/tools/build/builder-model/0.12.2/builder-model-0.12.2.jarDownload http://jcenter.bintray.com/com/android/tools/ddms/ddmlib/23.0.2/ddmlib-23.0.2.jarDownload http://jcenter.bintray.com/com/android/tools/build/manifest-merger/23.0.2/manifest-merger-23.0.2.jarDownload http://jcenter.bintray.com/com/android/tools/sdklib/23.0.2/sdklib-23.0.2.jarDownload http://jcenter.bintray.com/com/android/tools/common/23.0.2/common-23.0.2.jarDownload http://jcenter.bintray.com/com/android/tools/build/builder-test-api/0.12.2/builder-test-api-0.12.2.jarDownload http://jcenter.bintray.com/com/android/tools/lint/lint-api/23.0.2/lint-api-23.0.2.jarDownload http://jcenter.bintray.com/com/android/tools/layoutlib/layoutlib-api/23.0.2/layoutlib-api-23.0.2.jarDownload http://jcenter.bintray.com/com/android/tools/dvlib/23.0.2/dvlib-23.0.2.jarDownload http://jcenter.bintray.com/com/android/tools/build/gradle/0.12.2/gradle-0.12.2-sources.jarDownload http://jcenter.bintray.com/net/sf/proguard/proguard-base/4.11/proguard-base-4.11-sources.jarDownload http://jcenter.bintray.com/net/sf/proguard/proguard-gradle/4.11/proguard-gradle-4.11-sources.jarDownload http://jcenter.bintray.com/com/android/tools/common/23.0.2/common-23.0.2-sources.jarDownload http://jcenter.bintray.com/com/android/tools/layoutlib/layoutlib-api/23.0.2/layoutlib-api-23.0.2-sources.jarDownload http://jcenter.bintray.com/com/android/tools/dvlib/23.0.2/dvlib-23.0.2-sources.jarDownload http://jcenter.bintray.com/org/apache/commons/commons-compress/1.8.1/commons-compress-1.8.1-sources.jarDownload http://jcenter.bintray.com/com/android/tools/sdklib/23.0.2/sdklib-23.0.2-sources.jarDownload http://jcenter.bintray.com/com/android/tools/sdk-common/23.0.2/sdk-common-23.0.2-sources.jarDownload http://jcenter.bintray.com/com/android/tools/build/builder-model/0.12.2/builder-model-0.12.2-sources.jarDownload http://jcenter.bintray.com/com/android/tools/lint/lint-api/23.0.2/lint-api-23.0.2-sources.jarDownload http://jcenter.bintray.com/com/android/tools/lint/lint-checks/23.0.2/lint-checks-23.0.2-sources.jarDownload http://jcenter.bintray.com/com/android/tools/lint/lint/23.0.2/lint-23.0.2-sources.jarDownload http://jcenter.bintray.com/com/android/tools/ddms/ddmlib/23.0.2/ddmlib-23.0.2-sources.jarDownload http://jcenter.bintray.com/com/android/tools/build/manifest-merger/23.0.2/manifest-merger-23.0.2-sources.jarDownload http://jcenter.bintray.com/com/android/tools/build/builder-test-api/0.12.2/builder-test-api-0.12.2-sources.jarDownload http://jcenter.bintray.com/com/squareup/javawriter/2.5.0/javawriter-2.5.0-sources.jarDownload http://jcenter.bintray.com/com/android/tools/build/builder/0.12.2/builder-0.12.2-sources.jarBUILD SUCCESSFULTotal time: 2 mins 4.164 secsCreating ClassLoader cda10f2c-7a96-43f6-ac02-439fb293d088 from system and [org.gradle.internal.classloader.FilteringClassLoader@4f816407].Creating ClassLoader 8b556d42-4196-4015-bfce-da42e83769a2 from org.gradle.internal.classloader.MutableURLClassLoader$Spec@35f9a28 and [org.gradle.internal.classloader.FilteringClassLoader@4f816407].Creating ClassLoader 9e1e2c21-8d2b-41c0-8be0-3a6ce81cc7d9 from org.gradle.internal.classloader.MutableURLClassLoader$Spec@f99de5d2 and [org.gradle.tooling.internal.provider.ModelClassLoaderFactory$MixInClassLoader@30f69f4e].Creating ClassLoader cd6a6514-3fb0-480b-9a70-33a8541439a2 from org.gradle.internal.classloader.MutableURLClassLoader$Spec@ededb07a and [org.gradle.tooling.internal.provider.ModelClassLoaderFactory$MixInClassLoader@f54d2ff].Creating ClassLoader ff37e9e6-b1e6-4a5e-b18e-287576d9a310 from org.gradle.internal.classloader.MultiParentClassLoader$Spec@a612e20 and [org.gradle.tooling.internal.provider.ModelClassLoaderFactory$MixInClassLoader@f54d2ff, org.gradle.tooling.internal.provider.ModelClassLoaderFactory$MixInClassLoader@9e86b36].Creating ClassLoader 7b578a69-cddf-4fdc-95b1-7758c69fbef7 from org.gradle.internal.classloader.CachingClassLoader$Spec@a1369b1c and [org.gradle.internal.classloader.MultiParentClassLoader@79d6ab4e].Creating ClassLoader e709f50c-8ca2-4171-b07f-a1dd73c210cf from org.gradle.internal.classloader.MutableURLClassLoader$Spec@2c03066 and [org.gradle.internal.classloader.CachingClassLoader@7c88cc5f].Creating ClassLoader f910b95f-21b9-4b2d-b43d-28f848b37393 from org.gradle.internal.classloader.FilteringClassLoader$Spec@469d3ae7 and [org.gradle.tooling.internal.provider.ModelClassLoaderFactory$MixInClassLoader@7921b0d8].Creating ClassLoader 7aaf8593-ee35-4293-84b7-843ba0953f7f from org.gradle.internal.classloader.CachingClassLoader$Spec@a1369b1c and [org.gradle.internal.classloader.FilteringClassLoader@2b1e09a4].Creating ClassLoader bb9fe68f-796f-4102-8b5d-e105b443192d from org.gradle.internal.classloader.MutableURLClassLoader$Spec@811e0f46 and [org.gradle.internal.classloader.CachingClassLoader@410b0419].Creating ClassLoader 66239886-3a13-41f1-8437-e537c3e37cdc from org.gradle.internal.classloader.MutableURLClassLoader$Spec@b572a691 and [org.gradle.tooling.internal.provider.ModelClassLoaderFactory$MixInClassLoader@3a3a26ab].Creating ClassLoader ddf28e42-1797-4bba-8684-077d81c64b2b from org.gradle.internal.classloader.MutableURLClassLoader$Spec@d9326135 and [org.gradle.internal.classloader.CachingClassLoader@410b0419].Tooling API is using target Gradle version: 1.12.Tooling API is using target Gradle version: 1.12.Connected to the daemon. Dispatching Build{id=494ecf74-c1e3-48a1-a1b7-6c91646db023.1, currentDir=/home/kaizen/AndroidStudioProjects/MyApplication} request.Configuration on demand is an incubating feature.:app:preBuild:app:preDebugBuild:app:checkDebugManifest:app:prepareDebugDependencies:app:compileDebugAidl:app:compileDebugRenderscript:app:generateDebugBuildConfig:app:generateDebugAssets UP-TO-DATE:app:mergeDebugAssets:app:generateDebugResValues:app:generateDebugResources:app:mergeDebugResources:app:processDebugManifest:app:processDebugResources:app:generateDebugSourcesBUILD SUCCESSFULTotal time: 3.249 secs
2. Use gradle to compile and install the apk. The problem of INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION occurs.
Configure the <uses-sdk/> label in AndroidManifest. xml:
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="15" />
However, an error is reported during compilation and installation.
Later, we found that the build. gradle file was configured as follows:
apply plugin: 'com.android.application'android { compileSdkVersion 19 buildToolsVersion "19.1.0" defaultConfig { applicationId "com.example.kaizen.myapplication" minSdkVersion 15 targetSdkVersion 19 versionCode 1 versionName "1.0" } buildTypes { release { runProguard false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } }}dependencies { compile fileTree(dir: 'libs', include: ['*.jar'])}
Modify minSdkVersion 8, recompile and install successfully, and no error is reported.
Configure the java Runtime Environment in ubuntu
The main point is: put various directories and files supported by Java into environment variables.
There are three ways to put environment variables. You can learn this by yourself. I recommend that you put them in the current user's environment variables.
1. cd ~ That is, switch to the root directory of the current user. You don't need to explain this.
2. The vi. bashrc file is a configuration file of the current user. Add the following statement to the end.
Export JAVA_HOME =/usr/java/jdk
# Note: The above/usr/java/jdk is the jdk directory you downloaded. Configure the java main directory and add the following two rows to the row library.
Export PATH = $ JAVA_HOME/bin: $ PATH
Export CLASSPATH =.: $ JAVA_HOME/lib/dt. jar: $ JAVA_HOME/lib/tools. jar
3. Add source. bashrc to the environment variable, or restart.
Okay. Try the java command.
How to configure and configure the JAVA compiling environment in ubuntu
Download the JDK and install it. After installing the. bashrc file to modify/etc/profile or log on to the user, add the environment variable JAVA_HOME = [JDK installation directory] and modify PATH = $ JAVA_HOME/bin: $ PATH
To use IDE, download Eclipse or NetBean for linux.
I also use this ubuntu-11.04 Operating System