Android Studio Using Notes

Source: Internet
Author: User

Using the Gradle method:

If the compilation is successful, run the prompt

Com.android.ide.common.process.ProcessException:org.gradle.process.internal.ExecException:Process ' Command '/ Home/zhaokun/work/jdk1.7.0_71/bin/java ' finished with Non-zero exit value 2

You can run the./gradlew installdebug--stacktrace in the project root, or the following prompt is found in the IDE window Gradle console

com.android. Dex. Dexindexoverflowexception:cannot Merge new index 65949 into a Non-jumbo instruction!

In the main project of the Build.gradlefile,android{} Inside Add the following content

android.dexoptions {jumbomode = true//javamaxheapsize "2g"}eclipse is added project.properties in DEX.FORCE.J Umbo=true the source code of the third-party library is imported, copy it to the project root directory and create a new Build.gradle file under the source code directory (the content depends on the respective project):

Buildscript {
repositories {
Jcenter ()
}
dependencies {
Classpath ' com.android.tools.build:gradle:1.3.0 '
}
}

allprojects {
repositories {
Jcenter ()
}
}

Apply plugin: ' Android-library '


Android {
Compilesdkversion 19
Buildtoolsversion "23.0.0 RC3"

Defaultconfig {
Minsdkversion 9
Targetsdkversion 11
}
sourcesets {
Main {
Manifest.srcfile ' Androidmanifest.xml '
Java.srcdirs = [' src ']
Resources.srcdirs = [' src ']
Aidl.srcdirs = [' src ']
Renderscript.srcdirs = [' src ']
Res.srcdirs = [' res ']
Assets.srcdirs = [' assets '] jnilibs.srcdirs = [' Libs ']
}
}
}

dependencies {
Compile files (' Libs/xxxx.jar ')
}

The following error is indicated when the main project and the reference project Merge Androidmanifest conflict,
androidmanifest.xml:33:9-41 Error:
Attribute [email protected] value= (@string/ime_name) from androidmanifest.xml:33:9-41
is also present at [App2:unspecified] androidmanifest.xml:38:9-51 value= (@string/appcenter_app_name)
Workaround:
Add the following content to the <application> of the main project's Androidmanifest.xml file tools:replace= "Android:label,android:name"
which conflicts add which
Then add xmlns:tools= "Http://schemas.android.com/tools" within <manifest>

 Latest Version ANDROID&NBSP;STUDIO&NBSP;NDK debug: Specify NDK and SDK directories with local.properties files in directory ndk.dir=/home/***/work/sdk/ Ndk-bundlesdk.dir=/home/***/work/sdksettings.gradle file specifies the imported project include  ': Mainapp ' include  ': libApp ' Gradle/wrapper/gradle-wrapper.properties file distributionbase=gradle_user_homedistributionpath=wrapper/ distszipstorebase=gradle_user_homezipstorepath=wrapper/distsdistributionurl=https\://services.gradle.org/ Distributions/gradle-2.5-all.zip root directory Build.gradle file: buildscript {    repositories  {        jcenter ()     }     dependencies {        classpath  ' com.android.tools.build:gradle-experimental:0.2.0 '     }}allprojects {     repositories {        jcenter ()      }}module project directory under Build.gradle: 
apply plugin:  ' Com.android.model.application ' model {    android {         compileSdkVersion = buildToolsVersion =  Defaultconfig.with {            applicationid  = minSdkVersion.apiLevel = targetSdkVersion.apiLevel = }       }    android.buildTypes {         release {            minifyenabled  = proguardfiles += file ()         }     }    android.ndk {         modulename = string srcdirs = ${projectdir}string includesrcbase = ${ Srcdirs}string includesrc2base = ${srcdirs}stl += cflags += [                 includeSrcBase,                 includeSrc2Base]         cppFlags += [                 includeSrcBase,                 includeSrc2Base]}    android.productFlavors {         create ()  {             ndk.abifilters += }        create ()  {            ndk.abifilters += }        &Nbsp;create ()  {            ndk.abifilters  += }        create ()  {             ndk.abiFilters += }         create ()  {             Ndk.abifilters += }        create ()  {             ndk.abiFilters += }         create ()  {             ndk.abifilters += }        create ()      }    android.dexOptions {         Jumbomode = }    android.buildtypes {        release {             minifyenabled = proguardfiles  +=  file ()         }    }     android.sources {        {             manifest.source.srcdirs = []java.source.srcdirs = []             resources.source.srcdirs = [ ]            aidl.source.srcdirs = []             renderscript.source.srcdirs =  []            res.source.srcdirs =  []            assets.source.srcdirs = []             jniLibs.source.srcDirs = []             jni.source.srcDirs = []         }    }}dependencies {    compile  Project ()     compile filetree (:  , : [])}


Android Studio Using Notes

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.