• Android studio支持lamda


    https://www.jianshu.com/p/ef6cbf5ade71

    方法一:11.25新建的项目

    app的build.gradle下面:

    android {
        //只需要这样就行了
        compileOptions {
            sourceCompatibility JavaVersion.VERSION_1_8
            targetCompatibility JavaVersion.VERSION_1_8
        }
        ...
        defaultConfig {
            ...
        }
        ....
    }

    我的项目所有:

    app build.gradle如下:

    apply plugin: 'com.android.application'
    apply plugin: 'com.alipay.apollo.baseline.config'
    
    android {
        //支持lamda
        compileOptions {
            sourceCompatibility JavaVersion.VERSION_1_8
            targetCompatibility JavaVersion.VERSION_1_8
        }
        compileSdkVersion 30
        buildToolsVersion "30.0.2"
    
        defaultConfig {
            applicationId "com.zhu.mpaas"
            minSdkVersion 19
    //        接入第1步
            targetSdkVersion 26
            versionCode 1
            versionName "1.0"
            ndk{
                abiFilters 'armeabi'
            }
            testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
            multiDexEnabled true
        }
    
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro','mpProguard.cfg'
            }
        }
    }
    
    dependencies {
        implementation 'androidx.multidex:multidex:2.0.1'
        implementation platform("com.mpaas.android:$mpaas_artifact:$mpaas_baseline")
        implementation fileTree(dir: "libs", include: ["*.jar"])
        implementation 'androidx.appcompat:appcompat:1.2.0'
        implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
        implementation 'com.mpaas.android:essential'
        implementation 'com.mpaas.android:framework'
        implementation 'com.mpaas.android:configservice'
        implementation 'com.mpaas.android:media'
        implementation 'com.mpaas.android:nebula'
        implementation 'com.mpaas.android:push'
        implementation 'com.mpaas.android:tinyapp'
        implementation 'com.mpaas.android:tinyapp-media'
        implementation 'com.mpaas.android:tinyapp-scan'
        implementation 'com.mpaas.android:tinyapp-video'
        implementation 'com.mpaas.android:uccore'
        implementation 'com.mpaas.android:upgrade'
        testImplementation 'junit:junit:4.12'
        androidTestImplementation 'androidx.test.ext:junit:1.1.2'
        androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
    
        //权限申请
        implementation 'com.github.tbruyelle:rxpermissions:0.12'
        implementation 'io.reactivex.rxjava3:rxjava:3.0.4'
        implementation 'io.reactivex.rxjava3:rxandroid:3.0.0'
    }

    project build.gradle如下:

    apply plugin: 'com.alipay.apollo.optimize'// Top-level build file where you can add configuration options common to all sub-projects/modules.
    buildscript {
        ext.mpaas_artifact = "mpaas-baseline"
        ext.mpaas_baseline = "10.1.68-18"
        repositories {
            google()
            jcenter()
            maven {
                url 'http://mvn.cloud.alipay.com/nexus/content/repositories/releases/'
                name 'alipay'
                credentials {
                    username 'mvn_read_ws'
                    password 'mrk8929'
                }
            }
        }
        dependencies {
            classpath "com.android.tools.build:gradle:4.0.1"
            classpath 'com.android.boost.easyconfig:easyconfig:2.4.3'
    
            // NOTE: Do not place your application dependencies here; they belong
            // in the individual module build.gradle files
        }
    }
    
    allprojects {
        repositories {
            google()
            jcenter()
            maven {
                url 'http://mvn.cloud.alipay.com/nexus/content/repositories/releases/'
                name 'alipay'
                credentials {
                    username 'mvn_read_ws'
                    password 'mrk8929'
                }
            }
            maven { url 'https://jitpack.io' }
        }
    }
    
    task clean(type: Delete) {
        delete rootProject.buildDir
    }

    方法二:针对老项目

    1,在 Project 的 build.gradle 中添加如下代码:

      dependencies {
            classpath 'me.tatarka:gradle-retrolambda:3.2.0'
      }

    2,在 Module 的 build.gradle 中添加如下代码:

      // 应用插件
      apply plugin: 'me.tatarka.retrolambda'
    
      // 支持Java8
      android {
          compileOptions {
              sourceCompatibility JavaVersion.VERSION_1_8
              targetCompatibility JavaVersion.VERSION_1_8
          }
      }
  • 相关阅读:
    SQL Server Management Studio
    uiimage拉伸
    时间空间复杂度
    冒泡选择排序

    插入排序
    快速构建APP
    TTTAtibutedlabel
    Git命令
    适配
  • 原文地址:https://www.cnblogs.com/Oldz/p/14036719.html
Copyright © 2020-2023  润新知