eclipse jar顺序迁移AS 例子

buildscript {
    repositories {
        maven{ url 'https://maven.aliyun.com/respository/google'}
        maven{ url 'https://maven.aliyun.com/respository/jcenter'}
  //      maven { url 'http://maven.aliyun.com/nexus/content/groups/public' }
        google()
//        jcenter()
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.5.1'
    }
}
apply plugin: 'android'

dependencies {
    compileOnly files('xxxservice/telephony/classes.jar')
    compileOnly files('xxxservice/xxxservice.jar')
    implementation fileTree(dir: 'libs', include: '*.jar')

}

android {
    signingConfigs {
        WeiXinconfig {
            storeFile file('sign/weixin.keystore')
            storePassword 'xxxx'
            keyAlias = 'androidxxxkey'
            keyPassword 'xxx'
        }

        rk3288config {
            storeFile file('sign/rk3288.keystore')
            storePassword 'xxx'
            keyAlias = 'androidxxkey'
            keyPassword 'xxx'
        }

    }

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

            //signingConfig signingConfigs.rk3288config
            signingConfig  signingConfigs.WeiXinconfig
        }
        debug {
            signingConfig signingConfigs.rk3288config
        }
    }

    compileSdkVersion 26
    buildToolsVersion "28.0.3"

    defaultConfig {
        targetSdkVersion 26
        minSdkVersion 22
        applicationId = 'com.xxxxx.xxxxx'
        versionCode = 1.0
        versionName = 'V2.92.L818.xxxx'
        versionNameSuffix = '-AS'
        applicationIdSuffix = ''
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }

    aaptOptions.cruncherEnabled = false
    aaptOptions.useNewCruncher = false
    useLibrary 'org.apache.http.legacy'

    sourceSets {
        main {
            manifest.srcFile 'AndroidManifest.xml'
            java.srcDirs = ['src']
            resources.srcDirs = ['src']
            aidl.srcDirs = ['src']
            renderscript.srcDirs = ['src']
            res.srcDirs = ['res']
            assets.srcDirs = ['assets']

            jni.srcDirs = []
            jniLibs.srcDirs = ['libs']
        }

        // Move the tests to tests/java, tests/res, etc...
        //instrumentTest.setRoot('tests')

        // Move the build types to build-types/<type>
        // For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
        // This moves them out of them default location under src/<type>/... which would
        // conflict with src/ being used by the main source set.
        // Adding new build types or product flavors should be accompanied
        // by a similar customization.
        debug.setRoot('build-types/debug')
        release.setRoot('build-types/release')
    }

}

allprojects {
    repositories {

        maven{ url 'https://maven.aliyun.com/respository/google'}
        maven{ url 'https://maven.aliyun.com/respository/gradle-plugin'}
        maven{ url 'https://maven.aliyun.com/respository/central'}
        maven { url 'https://maven.aliyun.com/repository/central' }
        google()
//        jcenter()
        mavenCentral()

        gradle.projectsEvaluated {
            tasks.withType(JavaCompile) {
                options.compilerArgs.add('-Xbootclasspath/p:xxxservice/telephony/classes.jar') // libs/framework.jar为项目相对目录
                options.compilerArgs.add('-Xbootclasspath/p:xxxservice/xxxservice.jar') // libs/framework.jar为项目相对目录
            }
        }
    }
}

preBuild {
    doLast {
        def imlFile = file(project.name + ".iml")
        println 'Change ' + project.name + '.iml order'
        try {
            def parsedXml = (new XmlParser()).parse(imlFile)
            def jdkNode = parsedXml.component[1].orderEntry.find { it.'@type' == 'jdk' }
            parsedXml.component[1].remove(jdkNode)
            def sdkString = "Android API " + android.compileSdkVersion.substring("android-".length()) + " Platform"
            new groovy.util.Node(parsedXml.component[1], 'orderEntry', ['type': 'jdk', 'jdkName': sdkString, 'jdkType': 'Android SDK'])
            groovy.xml.XmlUtil.serialize(parsedXml, new FileOutputStream(imlFile))
        } catch (FileNotFoundException e) {
            // nop, iml not found
        }
    }

}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值