apply plugin: 'com.android.library' android { compileSdkVersion 25 buildToolsVersion "26.0.0" defaultConfig { minSdkVersion 15 targetSdkVersion 25 versionCode 1 versionName "1.0" multiDexEnabled true testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } packagingOptions { //打包时的相关配置 exclude 'META-INF/DEPENDENCIES' exclude 'META-INF/NOTICE' exclude 'META-INF/LICENSE' exclude 'META-INF/LICENSE.txt' exclude 'META-INF/NOTICE.txt' } dexOptions { javaMaxHeapSize "4g" } android { lintOptions { abortOnError false } } } repositories { mavenCentral() flatDir { dirs 'libs' } } dependencies { compile fileTree(include: ['*.jar'], dir: 'libs') androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { exclude group: 'com.android.support', module: 'support-annotations' }) compile 'com.android.support:appcompat-v7:25.3.1' testCompile 'junit:junit:4.12' compile(name: 'peb-lib', ext: 'aar') compile 'com.android.support:cardview-v7:25.3.1' compile 'com.android.support:recyclerview-v7:25.3.1' compile 'com.squareup.picasso:picasso:2.4.0' compile 'com.squareup.okhttp:okhttp:2.4.0' compile 'com.squareup.okhttp:okhttp-urlconnection:2.2.0' compile 'com.github.bumptech.glide:glide:3.5.2' compile 'com.squareup.retrofit2:retrofit:2.3.0' compile 'com.squareup.retrofit2:converter-gson:2.3.0' compile 'com.google.android.gms:play-services-auth:8.3.0' compile 'com.tencent.mm.opensdk:wechat-sdk-android-without-mta:+' //微信 compile files('libs/UPPayAssistEx.jar') compile files('libs/UPPayPluginExPro.jar') compile files('libs/alipaySdk-20180601.jar') } task makeJar(type: Copy) { //删除存在的 delete 'build/libs/AllPaySDK.jar' //设置拷贝的文件 from('build/intermediates/bundles/release/') //打进jar包后的文件目录 into('build/libs/') //将classes.jar放入build/libs/目录下 exclude "**/**/**/BuildConfig.class" exclude "**/**/**/BuildConfig\$*.class" exclude('**/R.class') exclude('**/R\$*.class') include('xxx/**/*.class') include('classes.jar') //重命名 rename ('classes.jar', 'AllPaySDK.jar') } makeJar.dependsOn(build)