简体   繁体   English

在Android Studio中使用jar文件时出错

[英]Error while using jar file in android studio

I am new to android. 我是Android新手。 I am doing one project in that i want to use jar file. 我正在做一个项目,因为我想使用jar文件。 Actually I converted .apk file to .jar file by using dex2jar. 实际上,我是使用dex2jar将.apk文件转换为.jar文件的。 I added that .jar file in lib folder and added as library. 我在lib文件夹中添加了该.jar文件,并将其添加为库。 but when running the app it shows an error: Error:Execution failed for task ':app:dexDebug'. 但是在运行该应用程序时会显示错误:错误:任务':app:dexDebug'的执行失败。

com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\\Program Files\\Java\\jdk1.7.0_79\\bin\\java.exe'' finished with non-zero exit value 1 com.android.ide.common.process.ProcessException:org.gradle.process.internal.ExecException:处理'命令'C:\\ Program Files \\ Java \\ jdk1.7.0_79 \\ bin \\ java.exe'的完成非零退出值1

and my build.gradle file is 我的build.gradle文件是

apply plugin: 'com.android.application'

android {
    compileSdkVersion 22
    buildToolsVersion "22.0.1"

    defaultConfig {
        applicationId "com.protocolnet.myapplication"
        minSdkVersion 15
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    dexOptions {
        preDexLibraries = false
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:22.2.0'
    compile files('libs/viabee-dex2jar.jar')
}

. How to get rid from that error. 如何摆脱那个错误。 Please anybody help me? 请有人帮我吗?

You can't use .jar file converted from apk as a Library because of that it is not Library. 从apk转换的.jar文件不能用作库,因为它不是库。 You can get source code using this method . 您可以使用此方法获取源代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM