问题描述
我试图在我的应用中导入一个Jgrapht库,但是每次我尝试构建APK时,android studio都会显示我:
错误:执行失败任务':app:transformClassesWithPreJackPackagedLibrariesForDebug'。
这个问题是怎么解决的?请帮助我!
apply plugin:'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion '25 .0.0'
lintOptions {
checkReleaseBuilds false
//或者,如果您愿意,您可以继续检查发布版本中的错误,
//但是即使发现错误也继续构建:
abortOnError false
}
defaultConfig {
applicationId it.univpm.gruppoids.iotforemergencyandnavigation
minSdkVersion 16
targetSdkVersion 25
versionCode 1
versionName1.0
jackOptions {
enabled true
}
}
compileOptions {
增量真正
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
存储库{
maven {
urlhttps://mint.splunk.com/gradle/
}
}
packagingOptions {
不包括'META-INF / services / org.apache.sis.storage.DataStoreProvider'
排除'META-INF / ASL2.0'
排除'META-INF / LICENSE'
排除'META-INF / NOTICE'
排除'META-INF / NOTICE.txt'
排除'META-INF / LICENSE.txt'
排除'META-INF / MANIFEST.MF'
}
$ b $ * buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
$ b编译fileTree(包括:''.jar'],dir:'libs')
testCompile' junit:junit:4.12'
compile'com.android.support:design:25.0.0'
compile'com.android.support:appcompat-v7:25.0.0'
compile'com.android.support:percent:25.0.0'
compile'com.android.support:support-v4:25.0.0'
compile'com.journeyapps:zxing-android-embedded: 3.2.0@aar'
compile'com.google.zxing:core:3.2.1'
编译文件('lib / jgrapht-ext-1.0.0-uber.jar')
编译文件('lib / jgrapht-ext-1.0.0.jar')
编译文件('lib / jgrapht-demo-1.0.0.jar')
编译文件('lib / jgraph -5.13.0.0.jar')
编译文件('lib / antlr4-runtime-4.5.3.jar')
编译文件('lib / jgrapht-core-1.0.0.jar')
}
另一个gradle:
//顶级构建文件,您可以在其中添加所有子项目/模块通用的配置选项。
buildscript {
repositories {
mavenCentral()
/ * maven {
urlhttps://plugins.gradle.org/m2/
} * /
jcenter()
}
依赖关系{
classpath'com.android.tools.build:gradle:2.2.2'
classpath'me.tatarka:gradle-retrolambda:3.3.0'
}
}
allprojects {
存储库{
jcenter()
mavenCentral()
}
}
apply plugin:'me.tatarka.retrolambda'
任务清理(类型:删除){
delete rootProject.buildDir
}
我能想到的最简单的方法是使用maven,然后简单地将依赖关系添加到您的项目中。这可以为你自己设置JGraphT节省大量的时间。
你可以在这里找到如何在android studio中使用maven:
虽然JGraphT的依赖项位于Maven Releases部分:
I'm trying to import a Jgrapht library in my app, but every time i try to build APK, android studio shows me:
Error:Execution failed for task ':app:transformClassesWithPreJackPackagedLibrariesForDebug'.
What is the problem and how i can fix it? Please help me!
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion '25.0.0'
lintOptions {
checkReleaseBuilds false
// Or, if you prefer, you can continue to check for errors in release builds,
// but continue the build even when errors are found:
abortOnError false
}
defaultConfig {
applicationId "it.univpm.gruppoids.iotforemergencyandnavigation"
minSdkVersion 16
targetSdkVersion 25
versionCode 1
versionName "1.0"
jackOptions {
enabled true
}
}
compileOptions {
incremental true
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
repositories {
maven {
url "https://mint.splunk.com/gradle/"
}
}
packagingOptions {
exclude 'META-INF/services/org.apache.sis.storage.DataStoreProvider'
exclude 'META-INF/ASL2.0'
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/MANIFEST.MF'
}
/*buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}*/
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:design:25.0.0'
compile 'com.android.support:appcompat-v7:25.0.0'
compile 'com.android.support:percent:25.0.0'
compile 'com.android.support:support-v4:25.0.0'
compile 'com.journeyapps:zxing-android-embedded:3.2.0@aar'
compile 'com.google.zxing:core:3.2.1'
compile files('lib/jgrapht-ext-1.0.0-uber.jar')
compile files('lib/jgrapht-ext-1.0.0.jar')
compile files('lib/jgrapht-demo-1.0.0.jar')
compile files('lib/jgraph-5.13.0.0.jar')
compile files('lib/antlr4-runtime-4.5.3.jar')
compile files('lib/jgrapht-core-1.0.0.jar')
}
And the other gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
mavenCentral()
/*maven {
url "https://plugins.gradle.org/m2/"
}*/
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.2'
classpath 'me.tatarka:gradle-retrolambda:3.3.0'
}
}
allprojects {
repositories {
jcenter()
mavenCentral()
}
}
apply plugin: 'me.tatarka.retrolambda'
task clean(type: Delete) {
delete rootProject.buildDir
}
The easiest way I can think of is to use maven, then simply add the dependencies to your project. That'll save you a lot of hassel in setting up JGraphT by yourself.
you can find how to use maven with android studio here: How to import Maven dependency in Android Studio/IntelliJ?
While JGraphT's dependencies are here under the "Maven Releases" section:http://jgrapht.org/
这篇关于com.android.jack.ir.ast.JReturnStatement at“未知来源信息”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!