-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.gradle
143 lines (123 loc) · 7.35 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
apply plugin: 'com.android.application'
android {
compileSdkVersion 29
defaultConfig {
applicationId "su.sadrobot.yashlang"
minSdkVersion 17
targetSdkVersion 29
versionCode 17
versionName "0.8.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
// Required when setting minSdkVersion to 20 or lower
multiDexEnabled true
javaCompileOptions {
annotationProcessorOptions {
arguments = ["room.schemaLocation": "$projectDir/schemas".toString()]
}
}
}
// для exoplayer 2.10.8 (> 2.7.3)
// https://exoplayer.dev/hello-world.html
// https://github.com/google/ExoPlayer/issues/5276
// и для поддержки старых андроидов с новым NewPipeExtractor
compileOptions {
// Flag to enable support for the new language APIs
coreLibraryDesugaringEnabled true
// Sets Java compatibility to Java 8
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
// без этой записи приложение не сможет найти и загрузить ресурсы - файл json, например
// (как в режиме десктопа из DataIOTest, так и при запуске на устройстве).
// (по ссылке немного не так настроено)
// https://blog.codetitans.pl/post/howto-assets-android-unittest/
sourceSets {
main {
resources {
srcDirs 'src/main/assets'
}
}
}
}
dependencies {
// Support older Android < API=26 with newer NewPipeExtractor
// https://github.com/TeamNewPipe/NewPipeExtractor
// > Note: To use NewPipe Extractor in projects with a minSdkVersion below 26, API desugaring is required.
// https://developer.android.com/studio/write/java8-support#library-desugaring
// https://developer.android.com/studio/releases/gradle-plugin#updating-plugin
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
// for @NonNull and @ annotations in DownloaderTestImpl since NewPipeExtractor 0.18.x
implementation 'com.github.spotbugs:spotbugs-annotations:3.1.0'
// ViewPager, RecyclerView (компеляецца и так)
//implementation 'androidx.viewpager:viewpager:1.0.0'
//implementation 'androidx.recyclerview:recyclerview:1.0.0'
// TabLayout
implementation 'com.google.android.material:material:1.0.0'
// tab widget in NewPipe added in this way
// android.support.design.widget.
// implementation "com.android.support:design:${supportLibVersion}"
// Paging
// https://developer.android.com/topic/libraries/architecture/paging/
implementation 'androidx.paging:paging-runtime:2.1.2'
// ROOM
// https://developer.android.com/jetpack/androidx/releases/room
def room_version = "2.2.5"
implementation "androidx.room:room-runtime:$room_version"
annotationProcessor "androidx.room:room-compiler:$room_version"
// optional - RxJava support for Room
//implementation "androidx.room:room-rxjava2:$room_version"
// optional - Guava support for Room, including Optional and ListenableFuture
//implementation "androidx.room:room-guava:$room_version"
// Test helpers
//testImplementation "androidx.room:room-testing:$room_version"
// https://github.com/square/okhttp
// https://square.github.io/okhttp/changelog/
// Требуется для NewPipeExtractor с некоторых версий, без него компилируется,
// но не работает загрузка плейлистов дальше 2-й страницы
// 4.8.1 компилируется с текущими настройками проекта
// 4.9.0 - уже нет
implementation 'com.squareup.okhttp3:okhttp:4.8.1'
// NewPipe: youtube parser
// https://github.com/TeamNewPipe/NewPipeExtractor
// в 0.20.3 появился класс Instant, который появился в API level 26
// https://developer.android.com/reference/java/time/Instant.html
// У меня на планшете Самсунг Android 7.1.1 - это API level 25
// https://developer.android.com/studio/releases/platforms
// с NewPipeExtractor:v0.20.3 вылетает с ClassNotFound при добавлении плейлиста
// с NewPipeExtractor:v0.20.2 работает ок
// поэтому останемся пока на 0.20.2, по крайней мере пока не поломают Ютюб
// implementation "com.github.TeamNewPipe:NewPipeExtractor:v0.20.2"
// таки ютюб поломали, апгрейдимся
// (и дропать старые андроиды не обязательно - для этого есть coreLibraryDesugaringEnabled true)
// https://developer.android.com/studio/write/java8-support#library-desugaring
implementation "com.github.TeamNewPipe:NewPipeExtractor:v0.21.13"
// google Exoplayer
// https://github.com/google/ExoPlayer
// https://exoplayer.dev/
implementation 'com.google.android.exoplayer:exoplayer:2.15.1'
// Это для запуска DataIOTest без андроида на десктопе, чтобы избежать ошибки
// java.lang.RuntimeException: Stub! из реализации JSONObject из android-xx.jar
// Но просто так всё равно запустить не получится, т.к. android-xx.jar в класпасе
// будет всегда выше, чем любая библиотека отсюда
// Чтобы запустить и не получить ошибку, нужно внутри файла .idea/modules/app/yashlang.app.iml переместить запись
// <orderEntry type="jdk" jdkName="Android API 29 Platform" jdkType="Android SDK" />
// ниже аналогичных записей, относящихся к тестам (конкретно, "org.json:json") вручную
// и делать это каждый раз при перезапуске среды или при изменении build.gradle здесь
// https://stackoverflow.com/questions/22863845/how-to-configure-the-order-of-libraries-in-the-classpath-for-android-studio
// там же по ссылке предлгаюат написать код, который будет это делать автоматом (пока нах)
// и еще здесь другое решение через какой-то App Engine, которого у меня, скорее всего, нет и нах он нужен
// https://stackoverflow.com/questions/31698510/can-i-force-the-order-of-dependencies-in-my-classpath-with-gradle
testImplementation 'org.json:json:20171018'
}