0%

Androidx依赖库映射

问题及解决

今天回顾了一下《第一行代码 第二版》中关于安卓四种基本布局的内容,其中涉及到了一个百分比布局。书上是在build.gradle文件中的dependenices闭包下添加下面这行代码:

1
compile 'com.android.support:percent:24.2.1'

(感觉更maven的导入依赖包一样,有空再深入了解一下)。
但我所用的环境为Android Studio 4.1.3,SDK版本为29。其dependenices内容如下:

1
2
3
4
5
6
7
8
9
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
}

嗯,貌似第2、3、4项也是导入的内容,但却用的不是compile而是implimentation。搜索了解到确实是这样,而且还有以下问题:

  1. Android studio升级到3.0之后,摒弃了compile,改为使用implementation
  2. Androidx库和Android.support库不能共存

综上,在现版本中应该这样添加百分比依赖

1
implementation 'androidx.percentlayout:percentlayout:1.0.0'

拓展

附上androidx的映射表

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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
android.arch.core:common
androidx.arch.core:core-common:2.0.0-rc01

android.arch.core:core
androidx.arch.core:core:2.0.0-rc01

android.arch.core:core-testing
androidx.arch.core:core-testing:2.0.0-rc01

android.arch.core:runtime
androidx.arch.core:core-runtime:2.0.0-rc01

android.arch.lifecycle:common
androidx.lifecycle:lifecycle-common:2.0.0-rc01

android.arch.lifecycle:common-java8
androidx.lifecycle:lifecycle-common-java8:2.0.0-rc01

android.arch.lifecycle:compiler
androidx.lifecycle:lifecycle-compiler:2.0.0-rc01

android.arch.lifecycle:extensions
androidx.lifecycle:lifecycle-extensions:2.0.0-rc01

android.arch.lifecycle:livedata
androidx.lifecycle:lifecycle-livedata:2.0.0-rc01

android.arch.lifecycle:livedata-core
androidx.lifecycle:lifecycle-livedata-core:2.0.0-rc01

android.arch.lifecycle:reactivestreams
androidx.lifecycle:lifecycle-reactivestreams:2.0.0-rc01

android.arch.lifecycle:runtime
androidx.lifecycle:lifecycle-runtime:2.0.0-rc01

android.arch.lifecycle:viewmodel
androidx.lifecycle:lifecycle-viewmodel:2.0.0-rc01

android.arch.paging:common
androidx.paging:paging-common:2.0.0-rc01

android.arch.paging:runtime
androidx.paging:paging-runtime:2.0.0-rc01

android.arch.paging:rxjava2
androidx.paging:paging-rxjava2:2.0.0-rc01

android.arch.persistence.room:common
androidx.room:room-common:2.0.0-rc01

android.arch.persistence.room:compiler
androidx.room:room-compiler:2.0.0-rc01

android.arch.persistence.room:guava
androidx.room:room-guava:2.0.0-rc01

android.arch.persistence.room:migration
androidx.room:room-migration:2.0.0-rc01

android.arch.persistence.room:runtime
androidx.room:room-runtime:2.0.0-rc01

android.arch.persistence.room:rxjava2
androidx.room:room-rxjava2:2.0.0-rc01

android.arch.persistence.room:testing
androidx.room:room-testing:2.0.0-rc01

android.arch.persistence:db
androidx.sqlite:sqlite:2.0.0-rc01

android.arch.persistence:db-framework
androidx.sqlite:sqlite-framework:2.0.0-rc01

com.android.support.constraint:constraint-layout
androidx.constraintlayout:constraintlayout:1.1.2

com.android.support.constraint:constraint-layout-solver
androidx.constraintlayout:constraintlayout-solver:1.1.2

com.android.support.test.espresso.idling:idling-concurrent
androidx.test.espresso.idling:idling-concurrent:3.1.0

com.android.support.test.espresso.idling:idling-net
androidx.test.espresso.idling:idling-net:3.1.0

com.android.support.test.espresso:espresso-accessibility
androidx.test.espresso:espresso-accessibility:3.1.0

com.android.support.test.espresso:espresso-contrib
androidx.test.espresso:espresso-contrib:3.1.0

com.android.support.test.espresso:espresso-core
androidx.test.espresso:espresso-core:3.1.0

com.android.support.test.espresso:espresso-idling-resource
androidx.test.espresso:espresso-idling-resource:3.1.0

com.android.support.test.espresso:espresso-intents
androidx.test.espresso:espresso-intents:3.1.0

com.android.support.test.espresso:espresso-remote
androidx.test.espresso:espresso-remote:3.1.0

com.android.support.test.espresso:espresso-web
androidx.test.espresso:espresso-web:3.1.0

com.android.support.test.janktesthelper:janktesthelper
androidx.test.jank:janktesthelper:1.0.1

com.android.support.test.services:test-services
androidx.test:test-services:1.1.0

com.android.support.test.uiautomator:uiautomator
androidx.test.uiautomator:uiautomator:2.2.0

com.android.support.test:monitor
androidx.test:monitor:1.1.0

com.android.support.test:orchestrator
androidx.test:orchestrator:1.1.0

com.android.support.test:rules
androidx.test:rules:1.1.0

com.android.support.test:runner
androidx.test:runner:1.1.0

com.android.support:animated-vector-drawable
androidx.vectordrawable:vectordrawable-animated:1.0.0

com.android.support:appcompat-v7
androidx.appcompat:appcompat:1.0.0

com.android.support:asynclayoutinflater
androidx.asynclayoutinflater:asynclayoutinflater:1.0.0

com.android.support:car
androidx.car:car:1.0.0-alpha5

com.android.support:cardview-v7
androidx.cardview:cardview:1.0.0

com.android.support:collections
androidx.collection:collection:1.0.0

com.android.support:coordinatorlayout
androidx.coordinatorlayout:coordinatorlayout:1.0.0

com.android.support:cursoradapter
androidx.cursoradapter:cursoradapter:1.0.0

com.android.support:customtabs
androidx.browser:browser:1.0.0

com.android.support:customview
androidx.customview:customview:1.0.0

com.android.support:design
com.google.android.material:material:1.0.0-rc01

com.android.support:documentfile
androidx.documentfile:documentfile:1.0.0

com.android.support:drawerlayout
androidx.drawerlayout:drawerlayout:1.0.0

com.android.support:exifinterface
androidx.exifinterface:exifinterface:1.0.0

com.android.support:gridlayout-v7
androidx.gridlayout:gridlayout:1.0.0

com.android.support:heifwriter
androidx.heifwriter:heifwriter:1.0.0

com.android.support:interpolator
androidx.interpolator:interpolator:1.0.0

com.android.support:leanback-v17
androidx.leanback:leanback:1.0.0

com.android.support:loader
androidx.loader:loader:1.0.0

com.android.support:localbroadcastmanager
androidx.localbroadcastmanager:localbroadcastmanager:1.0.0

com.android.support:media2
androidx.media2:media2:1.0.0-alpha03

com.android.support:media2-exoplayer
androidx.media2:media2-exoplayer:1.0.0-alpha01

com.android.support:mediarouter-v7
androidx.mediarouter:mediarouter:1.0.0

com.android.support:multidex
androidx.multidex:multidex:2.0.0

com.android.support:multidex-instrumentation
androidx.multidex:multidex-instrumentation:2.0.0

com.android.support:palette-v7
androidx.palette:palette:1.0.0

com.android.support:percent
androidx.percentlayout:percentlayout:1.0.0

com.android.support:preference-leanback-v17
androidx.leanback:leanback-preference:1.0.0

com.android.support:preference-v14
androidx.legacy:legacy-preference-v14:1.0.0

com.android.support:preference-v7
androidx.preference:preference:1.0.0

com.android.support:print
androidx.print:print:1.0.0

com.android.support:recommendation
androidx.recommendation:recommendation:1.0.0

com.android.support:recyclerview-selection
androidx.recyclerview:recyclerview-selection:1.0.0

com.android.support:recyclerview-v7
androidx.recyclerview:recyclerview:1.0.0

com.android.support:slices-builders
androidx.slice:slice-builders:1.0.0

com.android.support:slices-core
androidx.slice:slice-core:1.0.0

com.android.support:slices-view
androidx.slice:slice-view:1.0.0

com.android.support:slidingpanelayout
androidx.slidingpanelayout:slidingpanelayout:1.0.0

com.android.support:support-annotations
androidx.annotation:annotation:1.0.0

com.android.support:support-compat
androidx.core:core:1.0.0

com.android.support:support-content
androidx.contentpager:contentpager:1.0.0

com.android.support:support-core-ui
androidx.legacy:legacy-support-core-ui:1.0.0

com.android.support:support-core-utils
androidx.legacy:legacy-support-core-utils:1.0.0

com.android.support:support-dynamic-animation
androidx.dynamicanimation:dynamicanimation:1.0.0

com.android.support:support-emoji
androidx.emoji:emoji:1.0.0

com.android.support:support-emoji-appcompat
androidx.emoji:emoji-appcompat:1.0.0

com.android.support:support-emoji-bundled
androidx.emoji:emoji-bundled:1.0.0

com.android.support:support-fragment
androidx.fragment:fragment:1.0.0

com.android.support:support-media-compat
androidx.media:media:1.0.0

com.android.support:support-tv-provider
androidx.tvprovider:tvprovider:1.0.0

com.android.support:support-v13
androidx.legacy:legacy-support-v13:1.0.0

com.android.support:support-v4
androidx.legacy:legacy-support-v4:1.0.0

com.android.support:support-vector-drawable
androidx.vectordrawable:vectordrawable:1.0.0

com.android.support:swiperefreshlayout
androidx.swiperefreshlayout:swiperefreshlayout:1.0.0

com.android.support:textclassifier
androidx.textclassifier:textclassifier:1.0.0

com.android.support:transition
androidx.transition:transition:1.0.0

com.android.support:versionedparcelable
androidx.versionedparcelable:versionedparcelable:1.0.0

com.android.support:viewpager
androidx.viewpager:viewpager:1.0.0

com.android.support:wear
androidx.wear:wear:1.0.0

com.android.support:webkit
androidx.webkit:webkit:1.0.0
-------------------本文结束 感谢阅读-------------------