正在显示
4 个修改的文件
包含
42 行增加
和
5 行删除
| @@ -21,5 +21,10 @@ | @@ -21,5 +21,10 @@ | ||
| 21 | <option name="name" value="Google" /> | 21 | <option name="name" value="Google" /> |
| 22 | <option name="url" value="https://dl.google.com/dl/android/maven2/" /> | 22 | <option name="url" value="https://dl.google.com/dl/android/maven2/" /> |
| 23 | </remote-repository> | 23 | </remote-repository> |
| 24 | + <remote-repository> | ||
| 25 | + <option name="id" value="MavenRepo" /> | ||
| 26 | + <option name="name" value="MavenRepo" /> | ||
| 27 | + <option name="url" value="https://repo.maven.apache.org/maven2/" /> | ||
| 28 | + </remote-repository> | ||
| 24 | </component> | 29 | </component> |
| 25 | </project> | 30 | </project> |
| @@ -12,6 +12,7 @@ buildscript { | @@ -12,6 +12,7 @@ buildscript { | ||
| 12 | dependencies { | 12 | dependencies { |
| 13 | classpath 'com.android.tools.build:gradle:4.1.2' | 13 | classpath 'com.android.tools.build:gradle:4.1.2' |
| 14 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" | 14 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" |
| 15 | + classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.15' | ||
| 15 | // NOTE: Do not place your application dependencies here; they belong | 16 | // NOTE: Do not place your application dependencies here; they belong |
| 16 | // in the individual module build.gradle files | 17 | // in the individual module build.gradle files |
| 17 | } | 18 | } |
| @@ -20,6 +21,7 @@ buildscript { | @@ -20,6 +21,7 @@ buildscript { | ||
| 20 | allprojects { | 21 | allprojects { |
| 21 | repositories { | 22 | repositories { |
| 22 | google() | 23 | google() |
| 24 | + mavenCentral() | ||
| 23 | jcenter() | 25 | jcenter() |
| 24 | 26 | ||
| 25 | } | 27 | } |
| @@ -39,7 +41,9 @@ ext { | @@ -39,7 +41,9 @@ ext { | ||
| 39 | androidx_core: "1.2.0", | 41 | androidx_core: "1.2.0", |
| 40 | dagger : "2.27", | 42 | dagger : "2.27", |
| 41 | ] | 43 | ] |
| 42 | - | 44 | + generated = [ |
| 45 | + protoSrc: "$projectDir/../livekit-server/proto", | ||
| 46 | + ] | ||
| 43 | deps = [ | 47 | deps = [ |
| 44 | ] | 48 | ] |
| 45 | annotations = [ | 49 | annotations = [ |
| 1 | apply plugin: 'com.android.library' | 1 | apply plugin: 'com.android.library' |
| 2 | apply plugin: 'kotlin-android' | 2 | apply plugin: 'kotlin-android' |
| 3 | -apply plugin: 'kotlin-android-extensions' | 3 | +apply plugin: 'com.google.protobuf' |
| 4 | + | ||
| 4 | android { | 5 | android { |
| 5 | compileSdkVersion 29 | 6 | compileSdkVersion 29 |
| 6 | buildToolsVersion "29.0.3" | 7 | buildToolsVersion "29.0.3" |
| @@ -23,11 +24,39 @@ android { | @@ -23,11 +24,39 @@ android { | ||
| 23 | } | 24 | } |
| 24 | } | 25 | } |
| 25 | 26 | ||
| 26 | - android { | 27 | + sourceSets { |
| 28 | + main.java.srcDirs += "${protobuf.generatedFilesBaseDir}/main/javalite" | ||
| 29 | + main.proto.srcDirs += "${generated.protoSrc}" | ||
| 30 | + } | ||
| 31 | + | ||
| 27 | compileOptions { | 32 | compileOptions { |
| 28 | sourceCompatibility java_version | 33 | sourceCompatibility java_version |
| 29 | targetCompatibility java_version | 34 | targetCompatibility java_version |
| 30 | } | 35 | } |
| 36 | +} | ||
| 37 | + | ||
| 38 | +protobuf { | ||
| 39 | + protoc { | ||
| 40 | + // You still need protoc like in the non-Android case | ||
| 41 | + artifact = 'com.google.protobuf:protoc:3.0.0' | ||
| 42 | + } | ||
| 43 | + plugins { | ||
| 44 | + javalite { | ||
| 45 | + // The codegen for lite comes as a separate artifact | ||
| 46 | + artifact = 'com.google.protobuf:protoc-gen-javalite:3.0.0' | ||
| 47 | + } | ||
| 48 | + } | ||
| 49 | + generateProtoTasks { | ||
| 50 | + all().each { task -> | ||
| 51 | + task.builtins { | ||
| 52 | + // In most cases you don't need the full Java output | ||
| 53 | + // if you use the lite output. | ||
| 54 | + remove java | ||
| 55 | + } | ||
| 56 | + task.plugins { | ||
| 57 | + javalite {} | ||
| 58 | + } | ||
| 59 | + } | ||
| 31 | } | 60 | } |
| 32 | } | 61 | } |
| 33 | 62 | ||
| @@ -37,6 +66,7 @@ dependencies { | @@ -37,6 +66,7 @@ dependencies { | ||
| 37 | implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.2' | 66 | implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.2' |
| 38 | implementation 'org.webrtc:google-webrtc:1.0.32006' | 67 | implementation 'org.webrtc:google-webrtc:1.0.32006' |
| 39 | implementation "com.squareup.okhttp3:okhttp:4.9.0" | 68 | implementation "com.squareup.okhttp3:okhttp:4.9.0" |
| 69 | + implementation 'com.google.protobuf:protobuf-lite:3.0.1' | ||
| 40 | 70 | ||
| 41 | implementation 'com.google.dagger:dagger:2.32' | 71 | implementation 'com.google.dagger:dagger:2.32' |
| 42 | annotationProcessor 'com.google.dagger:dagger-compiler:2.32' | 72 | annotationProcessor 'com.google.dagger:dagger-compiler:2.32' |
| @@ -2,8 +2,6 @@ apply plugin: 'com.android.application' | @@ -2,8 +2,6 @@ apply plugin: 'com.android.application' | ||
| 2 | 2 | ||
| 3 | apply plugin: 'kotlin-android' | 3 | apply plugin: 'kotlin-android' |
| 4 | 4 | ||
| 5 | -apply plugin: 'kotlin-android-extensions' | ||
| 6 | - | ||
| 7 | android { | 5 | android { |
| 8 | compileSdkVersion 29 | 6 | compileSdkVersion 29 |
| 9 | buildToolsVersion "29.0.3" | 7 | buildToolsVersion "29.0.3" |
-
请 注册 或 登录 后发表评论