jar不会导出任何jar

jar不会导出任何jar

本文介绍了Android Studio Export jar不会导出任何jar的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是android studio的新手,我正在尝试从另一个Unity项目的Android Studio项目中导出一个jar。

I am fairly new to android studio, and I am trying to export a jar out of an Android Studio project for another Unity project.

我按照给出的指示在链接

I followed the instruction given on the link Create An Android Plugin For Unity Using Android Studio

但每当我试图导出其显示Build Successful和External task execution finished'exportJar'但我无法找到任何jar在gradle文件的指定文件夹中。

But whenever I'm trying to export its showing "Build Successful" and "External task execution finished 'exportJar'" but I am not able to find any jar in specified folder of gradle file.

我查看文件夹app / release为空,app / build / intermediates / bundles / release /只包含另一个名为instant-run的文件夹。

I looked into the folders "app/release" its empty and "app/build/intermediates/bundles/release/" contains only another folder named "instant-run".

所以我有点困惑,无论是跳过任何一步还是走错路。

So I am bit confused whether I am skipping any step or looking on the wrong path.

I m使用Android Studio v2.1.2

I m using Android Studio v2.1.2

App.build文件

App.build file

apply plugin: 'com.android.application'

android {
    compileSdkVersion 22
    buildToolsVersion "24.0.0"

    defaultConfig {
        applicationId "com.example.merchantapp"
        minSdkVersion 8
        targetSdkVersion 19
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:support-v4:22.2.1'
    compile files('libs/PGSDK_v1.0.jar')
    compile files('libs/classes.jar')
}
task deleteOldJar(type: Delete) {
    delete 'release/AndroidPlugin.jar'
}

//task to export contents as jar
task exportJar(type: Copy) {
    from('build/intermediates/bundles/release/')
    into('release/')
    include('classes.jar')
    ///Rename the jar
    rename('classes.jar', 'AndroidPlugin.jar')
}

exportJar.dependsOn(deleteOldJar, build)


android {
    lintOptions {
        abortOnError true
    }
}


推荐答案

你应该改变这一行

apply plugin:'com。 android.application'

apply plugin: 'com.android.application'

申请插件:'com.android.library'

apply plugin: 'com.android.library'

这是强制性的。然后重建您的项目。
因为我们正在生成库,它应该是构建jar文件所必需的。
参考

it is mandatory. and then rebuild your project.cause we are generating library and it should required for build jar file.reference How to export library to Jar in Android Studio?

这篇关于Android Studio Export jar不会导出任何jar的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-18 15:50