Я следовал учебному пособию по реализации API Карт Google с помощью Android Studio, и мой прогресс был остановлен, когда я узнал, что Place Picker обесценивается.В результате при открытии приложения происходит сбой.
В этом руководстве я реализовал MapView, функцию масштабирования, функцию центра и запрос на обновление местоположения, и у меня возникли проблемы с реализацией поиска местоположения.
private fun loadPlacePicker() { //creates new builder for an intent to start the Place Picker UI
val builder = PlacePicker.IntentBuilder()
try {
startActivityForResult(builder.build(this@MapsActivity), PLACE_PICKER_REQUEST)
} catch (e: GooglePlayServicesRepairableException) {
e.printStackTrace()
} catch (e: GooglePlayServicesNotAvailableException) {
e.printStackTrace()
}
}
Я полагаю, что ожидаемыми результатами будет реализация плавающей панели действий, которую можно использовать для поиска местоположения.В коде, PlacePicker является strkethrough-ed и отображает сообщение: «PlacePicker устарел. Устаревший в Java».
Отображается следующая ошибка, и я понятия не имею, что это значит:
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.myapplication, PID: 9675
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.myapplication/com.example.myapplication.MapsActivity}: android.view.InflateException: Binary XML file line #2 in com.example.myapplication:layout/activity_maps: Binary XML file line #2 in com.example.myapplication:layout/activity_maps: Error inflating class android.support.design.widget.CoordinatorLayout
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3121)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3257)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:81)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1935)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7116)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:925)
Caused by: android.view.InflateException: Binary XML file line #2 in com.example.myapplication:layout/activity_maps: Binary XML file line #2 in com.example.myapplication:layout/activity_maps: Error inflating class android.support.design.widget.CoordinatorLayout
Caused by: android.view.InflateException: Binary XML file line #2 in com.example.myapplication:layout/activity_maps: Error inflating class android.support.design.widget.CoordinatorLayout
Caused by: java.lang.ClassNotFoundException: android.support.design.widget.CoordinatorLayout
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:454)
at android.view.LayoutInflater.createView(LayoutInflater.java:830)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:1021)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:976)
at android.view.LayoutInflater.inflate(LayoutInflater.java:674)
at android.view.LayoutInflater.inflate(LayoutInflater.java:549)
at android.view.LayoutInflater.inflate(LayoutInflater.java:496)
at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:469)
at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
at com.example.myapplication.MapsActivity.onCreate(MapsActivity.kt:153)
at android.app.Activity.performCreate(Activity.java:7698)
at android.app.Activity.performCreate(Activity.java:7687)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1299)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3096)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3257)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:81)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1935)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7116)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:925)
E/AndroidRuntime: Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.design.widget.CoordinatorLayout" on path: DexPathList[[zip file "/data/app/com.example.myapplication-hlq7WMD7jhn1Gt1eYykECw==/base.apk", zip file "/data/app/com.example.myapplication-hlq7WMD7jhn1Gt1eYykECw==/split_lib_dependencies_apk.apk", zip file "/data/app/com.example.myapplication-hlq7WMD7jhn1Gt1eYykECw==/split_lib_resources_apk.apk", zip file "/data/app/com.example.myapplication-hlq7WMD7jhn1Gt1eYykECw==/split_lib_slice_0_apk.apk", zip file "/data/app/com.example.myapplication-hlq7WMD7jhn1Gt1eYykECw==/split_lib_slice_1_apk.apk", zip file "/data/app/com.example.myapplication-hlq7WMD7jhn1Gt1eYykECw==/split_lib_slice_2_apk.apk", zip file "/data/app/com.example.myapplication-hlq7WMD7jhn1Gt1eYykECw==/split_lib_slice_3_apk.apk", zip file "/data/app/com.example.myapplication-hlq7WMD7jhn1Gt1eYykECw==/split_lib_slice_4_apk.apk", zip file "/data/app/com.example.myapplication-hlq7WMD7jhn1Gt1eYykECw==/split_lib_slice_5_apk.apk", zip file "/data/app/com.example.myapplication-hlq7WMD7jhn1Gt1eYykECw==/split_lib_slice_6_apk.apk", zip file "/data/app/com.example.myapplication-hlq7WMD7jhn1Gt1eYykECw==/split_lib_slice_7_apk.apk", zip file "/data/app/com.example.myapplication-hlq7WMD7jhn1Gt1eYykECw==/split_lib_slice_8_apk.apk", zip file "/data/app/com.example.myapplication-hlq7WMD7jhn1Gt1eYykECw==/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.example.myapplication-hlq7WMD7jhn1Gt1eYykECw==/lib/x86, /system/lib, /system/product/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:196)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
... 26 more
Suppressed: java.io.IOException: No original dex files found for dex location /data/app/com.example.myapplication-hlq7WMD7jhn1Gt1eYykECw==/split_lib_resources_apk.apk
at dalvik.system.DexFile.openDexFileNative(Native Method)
at dalvik.system.DexFile.openDexFile(DexFile.java:365)
at dalvik.system.DexFile.<init>(DexFile.java:107)
at dalvik.system.DexFile.<init>(DexFile.java:80)
at dalvik.system.DexPathList.loadDexFile(DexPathList.java:444)
at dalvik.system.DexPathList.makeDexElements(DexPathList.java:403)
at dalvik.system.DexPathList.<init>(DexPathList.java:164)
at dalvik.system.BaseDexClassLoader.<init>(BaseDexClassLoader.java:126)
at dalvik.system.BaseDexClassLoader.<init>(BaseDexClassLoader.java:101)
at dalvik.system.PathClassLoader.<init>(PathClassLoader.java:74)
at com.android.internal.os.ClassLoaderFactory.createClassLoader(ClassLoaderFactory.java:87)
at com.android.internal.os.ClassLoaderFactory.createClassLoader(ClassLoaderFactory.java:116)
at android.app.ApplicationLoaders.getClassLoader(ApplicationLoaders.java:114)
at android.app.ApplicationLoaders.getClassLoaderWithSharedLibraries(ApplicationLoaders.java:60)
at android.app.LoadedApk.createOrUpdateClassLoaderLocked(LoadedApk.java:861)
at android.app.LoadedApk.getClassLoader(LoadedApk.java:958)
at android.app.LoadedApk.getResources(LoadedApk.java:1196)
at android.app.ContextImpl.createAppContext(ContextImpl.java:2462)
at android.app.ContextImpl.createAppContext(ContextImpl.java:2454)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6105)
at android.app.ActivityThread.access$1100(ActivityThread.java:211)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1778)
... 6 more