gpt4 book ai didi

android - 找不到来源

转载 作者:太空宇宙 更新时间:2023-11-03 13:26:46 25 4
gpt4 key购买 nike

由于我不是专家,我无法确定下面的错误是logcat。我正在调用另一个页面 onclick 按钮。在加载另一个页面时,我在

处收到错误
setContentView(R.layout.searchm); 

下面是源码和locgcat

Logcat如下

09-09 05:49:46.896: E/AndroidRuntime(2657): FATAL EXCEPTION: main
09-09 05:49:46.896: E/AndroidRuntime(2657): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.androidhive.googlemaps/com.androidhive.googlemaps.SearchActivity}: android.view.InflateException: Binary XML file line #6: Error inflating class CustomAutoCompleteTextView
09-09 05:49:46.896: E/AndroidRuntime(2657): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2211)
09-09 05:49:46.896: E/AndroidRuntime(2657): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
09-09 05:49:46.896: E/AndroidRuntime(2657): at android.app.ActivityThread.access$600(ActivityThread.java:141)
09-09 05:49:46.896: E/AndroidRuntime(2657): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
09-09 05:49:46.896: E/AndroidRuntime(2657): at android.os.Handler.dispatchMessage(Handler.java:99)
09-09 05:49:46.896: E/AndroidRuntime(2657): at android.os.Looper.loop(Looper.java:137)
09-09 05:49:46.896: E/AndroidRuntime(2657): at android.app.ActivityThread.main(ActivityThread.java:5103)
09-09 05:49:46.896: E/AndroidRuntime(2657): at java.lang.reflect.Method.invokeNative(Native Method)
09-09 05:49:46.896: E/AndroidRuntime(2657): at java.lang.reflect.Method.invoke(Method.java:525)
09-09 05:49:46.896: E/AndroidRuntime(2657): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
09-09 05:49:46.896: E/AndroidRuntime(2657): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
09-09 05:49:46.896: E/AndroidRuntime(2657): at dalvik.system.NativeStart.main(Native Method)
09-09 05:49:46.896: E/AndroidRuntime(2657): Caused by: android.view.InflateException: Binary XML file line #6: Error inflating class CustomAutoCompleteTextView
09-09 05:49:46.896: E/AndroidRuntime(2657): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:707)
09-09 05:49:46.896: E/AndroidRuntime(2657): at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
09-09 05:49:46.896: E/AndroidRuntime(2657): at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
09-09 05:49:46.896: E/AndroidRuntime(2657): at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
09-09 05:49:46.896: E/AndroidRuntime(2657): at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
09-09 05:49:46.896: E/AndroidRuntime(2657): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:267)
09-09 05:49:46.896: E/AndroidRuntime(2657): at android.app.Activity.setContentView(Activity.java:1895)
09-09 05:49:46.896: E/AndroidRuntime(2657): at com.androidhive.googlemaps.SearchActivity.onCreate(SearchActivity.java:26)
09-09 05:49:46.896: E/AndroidRuntime(2657): at android.app.Activity.performCreate(Activity.java:5133)
09-09 05:49:46.896: E/AndroidRuntime(2657): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
09-09 05:49:46.896: E/AndroidRuntime(2657): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2175)
09-09 05:49:46.896: E/AndroidRuntime(2657): ... 11 more
09-09 05:49:46.896: E/AndroidRuntime(2657): Caused by: java.lang.ClassNotFoundException: Didn't find class "android.view.CustomAutoCompleteTextView" on path: DexPathList[[zip file "/system/framework/com.google.android.maps.jar", zip file "/data/app/com.androidhive.googlemaps-2.apk"],nativeLibraryDirectories=[/data/app-lib/com.androidhive.googlemaps-2, /vendor/lib, /system/lib]]
09-09 05:49:46.896: E/AndroidRuntime(2657): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:53)
09-09 05:49:46.896: E/AndroidRuntime(2657): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
09-09 05:49:46.896: E/AndroidRuntime(2657): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
09-09 05:49:46.896: E/AndroidRuntime(2657): at android.view.LayoutInflater.createView(LayoutInflater.java:559)
09-09 05:49:46.896: E/AndroidRuntime(2657): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:652)
09-09 05:49:46.896: E/AndroidRuntime(2657): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:66)
09-09 05:49:46.896: E/AndroidRuntime(2657): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:669)
09-09 05:49:46.896: E/AndroidRuntime(2657): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:694)
09-09 05:49:46.896: E/AndroidRuntime(2657): ... 21 more

最佳答案

我认为您在布局 XML 中使用类 CustomAutoCompleteTextView(可能从 AutoCompleteTextView 扩展),而没有使用完整的类名(带包)。在这种情况下,Android 将自动尝试在包 android.view 中查找此类 - 但在您的情况下它无法找到(因为那里不存在 calss)。最有可能的是,您的 XML 包含如下内容:

<CustomAutoCompleteTextView ...>

相反,对于自定义类,您需要在包中指定完整的类名 - 因此将其更改为

<com.your.package.CustomAutoCompleteTextView ...>

关于android - 找不到来源,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18698125/

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