gpt4 book ai didi

android - 将 PlaceAutocompleteFragment 添加到 Activity 会引发错误

转载 作者:太空狗 更新时间:2023-10-29 14:50:51 27 4
gpt4 key购买 nike

我想实现 PlaceAutocompleteFragment based on the docs,在我的应用程序中,但是当我添加此代码段时

<fragment
android:id="@+id/place_autocomplete_fragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:name="com.google.android.gms.location.places.ui.PlaceAutocompleteFragment"
/>

最后一行抛出“无法解析符号‘PlaceAutocompleteFragment’”。这是为什么?

最佳答案

编译器找不到该类。您必须通过在 build.gradle 文件中添加以下代码 fragment 来导入该类。

dependencies {
compile 'com.google.android.gms:play-services-places:11.0.4'
}

关于android - 将 PlaceAutocompleteFragment 添加到 Activity 会引发错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35473891/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com