io中建立transformClassesWithJarMerg

io中建立transformClassesWithJarMerg

本文介绍了Android Studio中建立transformClassesWithJarMergingForDebug错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个新的项目我已经重新构建问题与Android工作室。请跟随我做了什么,如果任何人有任何想法如何着手,不要讲!

我开始一个新的项目,选择抽屉式导航活动'作为我的初始启动点(可以是任何东西我猜)。
我立刻建立我的新空的应用程序和调试它的真实设备(一个承上启下9)。所有运行良好。

然后我增加了一个办公文件创建库我想用于创建XLSX文件,所以我添加下面一行到我的build.gradle的应用程序文件(依赖):

 编译org.apache.poi:POI-OOXML:3.13

我重新同步,并建立OK(秒之内)。然后,我尝试调试这个真实设备上,但它并没有编译(需要更长的10倍,尝试构建),我得到一个错误:

I looked this up and every place I look people are telling others to use "multiDex". I understand this applies if you are exceeding 65K methods. I guess with the POI library I might well be exceeding that. After finding no other alternative course of action I implemented multiDex by adding the following lines to my build.gradle app file:

multiDexEnabled true
compile 'com.android.support:multidex:1.0.1'

and adding the following line to my Manifest file:

android:name="android.support.multidex.MultiDexApplication"

I assume I've implemented the multiDex ok. The app builds ok but when I attempt to debug it I am met with this error (takes about 7sec to get here):

No other files were tampered with. If I remove the compile POI library line from build.gradle then all is ok. I put the library back in, it fails in the same way.I've tried to figure out how to tell it to ignore the duplicate library in xmlbeans (again other posts tell coders this is what needs to be done) but I'm not sure how to do that and if that is the best way forwards ie should I still be multiDex'ing?

It's taken me a few days on-and-off to get this far and it's my first time using Android Studio - migrating away from Eclipse because I'm fed up of not being able to build my apps for days for no good reason.

Someone who knows what this all means... help me please!

Edit: I have cleaned & rebuilt the project and also tried deleting the build files but to no avail.


Program stats:

Android Studio 1.5.1
Build #AI-141.2456560, built on December 1, 2015
JRE: 1.8.0_25-b18 amd64
JVM: Java HotSpot(TM) 64-Bit Server VM by Oracle Corporation
Gradle ver: 2.8
Android plugin ver 1.5.0


'build.gradle' app file

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

    defaultConfig {
        applicationId "com.kane.testproject"
        minSdkVersion 15
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'com.android.support:design:23.1.1'
    compile 'org.apache.poi:poi-ooxml:3.13'
    compile 'com.android.support:multidex:1.0.1'
}

'AndroidManifest.xml' file

<?xml version="1.0" encoding="utf-8"?>
<manifest package="com.kane.testproject"
          xmlns:android="http://schemas.android.com/apk/res/android">
    <application
        android:name="android.support.multidex.MultiDexApplication"
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity
            android:name=".MainActivity"
            android:label="@string/app_name"
            android:theme="@style/AppTheme.NoActionBar">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>
    </application>
</manifest>
解决方案

Add the following lines in build.gradle(Module app)

dexOptions {
        javaMaxHeapSize "2g"
    }

这篇关于Android Studio中建立transformClassesWithJarMergingForDebug错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 01:32