我现在正在开发一个应用程序,并且正在使用场所选择器,但是现在不推荐使用。我想在我的应用中继续使用它,直到完全消失。我该怎么办?
我尝试使用地方的compat库,但出现显示编译错误的错误。
应用程序模块:
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
} } apply plugin: 'com.android.application' apply plugin: 'io.fabric'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.lim.therapist"
minSdkVersion 21
targetSdkVersion 27
versionCode 2
versionName "1.1"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
} } ext {
permissionsDispatcherVersion = '2.2.0' }
repositories {
maven { url 'https://jitpack.io' }
maven { url 'https://maven.fabric.io/public' } } dependencies {
implementation "com.github.hotchemi:permissionsdispatcher:${permissionsDispatcherVersion}"
implementation 'com.android.support:support-v4:27.1.1'
annotationProcessor "com.github.hotchemi:permissionsdispatcher-processor:${permissionsDispatcherVersion}"
implementation fileTree(include: ['*.jar'], dir: 'libs')
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation 'com.android.support:design:27.1.0'
implementation 'com.cocosw:bottomsheet:1.+@aar'
implementation 'com.isseiaoki:simplecropview:1.1.4'
implementation 'com.github.bumptech.glide:glide:3.7.0'
implementation 'com.github.florent37:singledateandtimepicker:1.2.2'
implementation 'de.hdodenhof:circleimageview:2.0.0'
implementation 'com.android.support:multidex:1.0.1'
implementation 'com.amitshekhar.android:android-networking:1.0.0'
implementation 'com.google.code.gson:gson:2.8.2'
implementation 'org.jsoup:jsoup:1.8.1'
implementation 'com.github.hani-momanii:SuperNova-Emoji:1.1'
implementation 'com.android.support:recyclerview-v7:27.1.1'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.ToxicBakery.viewpager.transforms:view-pager-transforms:1.2.32@aar'
implementation 'com.google.firebase:firebase-messaging:11.8.0'
implementation 'com.google.firebase:firebase-core:11.8.0'
implementation 'com.google.android.gms:play-services:11.8.0'
implementation 'com.google.android.gms:play-services-maps:11.8.0'
implementation 'com.google.android.gms:play-services-location:11.8.0'
implementation 'com.kyleduo.switchbutton:library:1.4.5'
implementation 'com.github.PhilJay:MPAndroidChart:v3.0.1'
implementation('com.crashlytics.sdk.android:crashlytics:2.9.4@aar') {
transitive = true;
} }
apply plugin: 'com.google.gms.google-services'
项目模块:
// Top-level build file where you can add configuration options common
to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
maven {
url "https://maven.google.com"
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.google.gms:google-services:4.2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
} }
allprojects {
repositories {
google()
jcenter()
} }
task clean(type: Delete) {
delete rootProject.buildDir }
Logcat:
019-02-14 03:09:18.684 28156-28156/com.lim.therapist E/AndroidRuntime:
FATAL EXCEPTION: main Process: com.lim.therapist, PID: 28156
java.lang.RuntimeException: Failure delivering result
ResultInfo{who=null, request=65637, result=2, data=null} to activity
{com.lim.therapist/com.lim.therapist.ui.activity.BaseActivity}:
java.lang.NullPointerException: intent must not be null at
android.app.ActivityThread.deliverResults(ActivityThread.java:4271) at
android.app.ActivityThread.handleSendResult(ActivityThread.java:4315)
at android.app.ActivityThread.-wrap19(Unknown Source:0) at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1647)
at android.os.Handler.dispatchMessage(Handler.java:106) at
android.os.Looper.loop(Looper.java:164) at
android.app.ActivityThread.main(ActivityThread.java:6518) at
java.lang.reflect.Method.invoke(Native Method) at
com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807) Caused
by: java.lang.NullPointerException: intent must not be null at
com.google.android.gms.common.internal.zzbq.checkNotNull(Unknown
Source:9) at
com.google.android.gms.location.places.ui.zza.getStatus(Unknown
Source:2) at
com.google.android.gms.location.places.ui.PlaceAutocomplete.getStatus(Unknown
Source:0) at
com.lim.therapist.ui.fragment.ArtistProfileView.onActivityResult(ArtistProfileView.java:491)
at
android.support.v4.app.FragmentActivity.onActivityResult(FragmentActivity.java:156)
at
com.lim.therapist.ui.activity.BaseActivity.onActivityResult(BaseActivity.java:523)
at android.app.Activity.dispatchActivityResult(Activity.java:7280) at
android.app.ActivityThread.deliverResults(ActivityThread.java:4267) at
android.app.ActivityThread.handleSendResult(ActivityThread.java:4315)
at android.app.ActivityThread.-wrap19(Unknown Source:0) at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1647)
at android.os.Handler.dispatchMessage(Handler.java:106) at
android.os.Looper.loop(Looper.java:164) at
android.app.ActivityThread.main(ActivityThread.java:6518) at
java.lang.reflect.Method.invoke(Native Method) at
com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
2019-02-14 03:09:18.981 28156-28156/com.lim.therapist
E/UncaughtException: java.lang.RuntimeException: Failure delivering
result ResultInfo{who=null, request=65637, result=2, data=null} to
activity
{com.lim.therapist/com.lim.therapist.ui.activity.BaseActivity}:
java.lang.NullPointerException: intent must not be null at
android.app.ActivityThread.deliverResults(ActivityThread.java:4271) at
android.app.ActivityThread.handleSendResult(ActivityThread.java:4315)
at android.app.ActivityThread.-wrap19(Unknown Source:0) at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1647)
at android.os.Handler.dispatchMessage(Handler.java:106) at
android.os.Looper.loop(Looper.java:164) at
android.app.ActivityThread.main(ActivityThread.java:6518) at
java.lang.reflect.Method.invoke(Native Method) at
com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807) Caused
by: java.lang.NullPointerException: intent must not be null at
com.google.android.gms.common.internal.zzbq.checkNotNull(Unknown
Source:9) at
com.google.android.gms.location.places.ui.zza.getStatus(Unknown
Source:2) at
com.google.android.gms.location.places.ui.PlaceAutocomplete.getStatus(Unknown
Source:0) at
com.lim.therapist.ui.fragment.ArtistProfileView.onActivityResult(ArtistProfileView.java:491)
at
android.support.v4.app.FragmentActivity.onActivityResult(FragmentActivity.java:156)
at
com.lim.therapist.ui.activity.BaseActivity.onActivityResult(BaseActivity.java:523)
at android.app.Activity.dispatchActivityResult(Activity.java:7280) at
android.app.ActivityThread.deliverResults(ActivityThread.java:4267)
我想继续使用位置选择器。请帮我。我是stackoverflow的新手,对于任何令人不悦的事情,我们深表歉意。谢谢
答案 0 :(得分:1)
使用兼容性库
dependencies {
implementation 'com.google.android.libraries.places:places-compat:1.0.0'
}
新客户端库中不支持Place Picker。要在弃用期间继续使用Place Picker,请确保安装兼容性库。
检查链接以获取更多信息。 Link