有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java 安卓。所容纳之物res.Resources$NotFoundException:资源ID#0x7f080087

在我发布的安卓应用程序中,我经常收到来自Crashlytics的崩溃报告,资源ID为0x7f080087,存在ResourcesNotFind异常

我已搜索特定的资源ID,但找不到任何内容

我的minSDK为21,targetSDK为29

崩溃报告的范围从Android版本5.1.1->;10,发生在有根和无根两种情况下,并且是多种设备的混合体

我还没能自己重现这个问题,这是我最大的问题。我已经尝试运行调试和发布apk,但我无法在我的设备上触发崩溃

我将非常感谢任何建议,因为这已开始成为一个大问题

选择MaponCreateView(rest只是单击侦听器),从中会发生错误:

package xxx

import 安卓.app.Activity;
import 安卓.content.Context;
import 安卓.content.SharedPreferences;
import 安卓.os.Build;
import 安卓.os.Bundle;
import 安卓.preference.PreferenceManager;
import 安卓.util.Log;
import 安卓.view.LayoutInflater;
import 安卓.view.MenuItem;
import 安卓.view.View;
import 安卓.view.ViewGroup;
import 安卓.widget.ImageView;


import 安卓x.annotation.NonNull;
import 安卓x.annotation.Nullable;
import 安卓x.fragment.app.Fragment;

import com.google.安卓.material.bottomnavigation.BottomNavigationView;
import com.google.firebase.analytics.FirebaseAnalytics;

public class ChooseMap extends Fragment implements View.OnClickListener{
String mode = "Competitive";
private static final String TAG = "ChooseMap";

private BottomNavigationView topNavigationView;

private SharedPreferences mSharedPreferences;
private SharedPreferences.Editor mEditor;

private ImageView cache, cobblestone, dustII, inferno, mirage, nuke, overpass, train, vertigo;
private View v;

@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    v = inflater.inflate(R.layout.choose_map, container, false);

    mSharedPreferences = PreferenceManager.getDefaultSharedPreferences(getActivity());
    mEditor = mSharedPreferences.edit();

    //Sets on click listeners on all images of maps
    cache = (ImageView) v.findViewById(R.id.Cache);
    cache.setOnClickListener(this);
    cobblestone = (ImageView) v.findViewById(R.id.Cobblestone);
    cobblestone.setOnClickListener(this);
    dustII = (ImageView) v.findViewById(R.id.DustII);
    dustII.setOnClickListener(this);
    inferno = (ImageView) v.findViewById(R.id.Inferno);
    inferno.setOnClickListener(this);
    mirage = (ImageView) v.findViewById(R.id.Mirage);
    mirage.setOnClickListener(this);
    nuke = (ImageView) v.findViewById(R.id.Nuke);
    nuke.setOnClickListener(this);
    overpass = (ImageView) v.findViewById(R.id.Overpass);
    overpass.setOnClickListener(this);
    train = (ImageView) v.findViewById(R.id.Train);
    train.setOnClickListener(this);
    vertigo = (ImageView) v.findViewById(R.id.Vertigo);
    vertigo.setOnClickListener(this);

    topNavigationView = v.findViewById(R.id.top_bar_navigation);
    topNavigationView.setSelectedItemId(R.id.competitive_menu);
    topNavigationView.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() {
        @Override
        public boolean onNavigationItemSelected(@NonNull MenuItem menuItem) {
           switch (menuItem.getItemId()){
               case R.id.arcade_menu:
                   mode = "Arcade";
                   break;
               case R.id.competitive_menu:
                   mode = "Competitive";
                   break;
           }
           return true;
        }
    });

    // Sets toolbar title to following string
    ((MainActivity)getActivity()).getSupportActionBar().setTitle("Choose Map");

    isAdLoaded();

    return v;
}

我得到以下堆栈跟踪

运行时异常

Fatal Exception: java.lang.RuntimeException: Unable to start activity ComponentInfo{<package>/<package>.MainActivity}: 安卓.view.InflateException: Binary XML file line #9: Error inflating class com.google.安卓.material.bottomnavigation.BottomNavigationView
   at 安卓.app.ActivityThread.performLaunchActivity(ActivityThread.java:2325)
   at 安卓.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)
   at 安卓.app.ActivityThread.access$800(ActivityThread.java:151)
   at 安卓.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)
   at 安卓.os.Handler.dispatchMessage(Handler.java:102)
   at 安卓.os.Looper.loop(Looper.java:135)
   at 安卓.app.ActivityThread.main(ActivityThread.java:5254)
   at java.lang.reflect.Method.invoke(Method.java)
   at java.lang.reflect.Method.invoke(Method.java:372)
   at com.安卓.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
   at com.安卓.internal.os.ZygoteInit.main(ZygoteInit.java:698)

资源查找

Caused by 安卓.content.res.Resources$NotFoundException: Resource ID #0x7f080089
   at 安卓.content.res.Resources.getValue(Resources.java:1266)
   at 安卓x.appcompat.widget.ResourceManagerInternal.loadDrawableFromDelegates(ResourceManagerInternal.java:252)
   at 安卓x.appcompat.widget.ResourceManagerInternal.getDrawable(ResourceManagerInternal.java:139)
   at 安卓x.appcompat.widget.ResourceManagerInternal.getDrawable(ResourceManagerInternal.java:132)
   at 安卓x.appcompat.content.res.AppCompatResources.getDrawable(AppCompatResources.java:104)
   at 安卓x.appcompat.view.menu.MenuItemImpl.getIcon(MenuItemImpl.java:505)
   at com.google.安卓.material.bottomnavigation.BottomNavigationItemView.initialize(BottomNavigationItemView.java:136)
   at com.google.安卓.material.bottomnavigation.BottomNavigationMenuView.buildMenuView(BottomNavigationMenuView.java:537)
   at com.google.安卓.material.bottomnavigation.BottomNavigationPresenter.updateMenuView(BottomNavigationPresenter.java:67)
   at com.google.安卓.material.bottomnavigation.BottomNavigationView.inflateMenu(BottomNavigationView.java:344)
   at com.google.安卓.material.bottomnavigation.BottomNavigationView.<init>(BottomNavigationView.java:226)
   at com.google.安卓.material.bottomnavigation.BottomNavigationView.<init>(BottomNavigationView.java:133)
   at java.lang.reflect.Constructor.newInstance(Constructor.java)
   at java.lang.reflect.Constructor.newInstance(Constructor.java:288)
   at 安卓.view.LayoutInflater.createView(LayoutInflater.java:607)
   at 安卓.view.LayoutInflater.createViewFromTag(LayoutInflater.java:743)
   at 安卓.view.LayoutInflater.rInflate(LayoutInflater.java:806)
   at 安卓.view.LayoutInflater.inflate(LayoutInflater.java:504)
   at 安卓.view.LayoutInflater.inflate(LayoutInflater.java:414)
   at <package>.ChooseMap.onCreateView(ChooseMap.java:41)
   at 安卓x.fragment.app.Fragment.performCreateView(Fragment.java:2600)
   at 安卓x.fragment.app.FragmentManagerImpl.moveToState(FragmentManagerImpl.java:881)
   at 安卓x.fragment.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManagerImpl.java:1238)
   at 安卓x.fragment.app.FragmentManagerImpl.moveToState(FragmentManagerImpl.java:1303)
   at 安卓x.fragment.app.BackStackRecord.executeOps(BackStackRecord.java:439)
   at 安卓x.fragment.app.FragmentManagerImpl.executeOps(FragmentManagerImpl.java:2079)
   at 安卓x.fragment.app.FragmentManagerImpl.executeOpsTogether(FragmentManagerImpl.java:1869)
   at 安卓x.fragment.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManagerImpl.java:1824)
   at 安卓x.fragment.app.FragmentManagerImpl.execPendingActions(FragmentManagerImpl.java:1727)
   at 安卓x.fragment.app.FragmentManagerImpl.dispatchStateChange(FragmentManagerImpl.java:2663)
   at 安卓x.fragment.app.FragmentManagerImpl.dispatchActivityCreated(FragmentManagerImpl.java:2613)
   at 安卓x.fragment.app.FragmentController.dispatchActivityCreated(FragmentController.java:246)
   at 安卓x.fragment.app.FragmentActivity.onStart(FragmentActivity.java:542)
   at 安卓x.appcompat.app.AppCompatActivity.onStart(AppCompatActivity.java:201)
   at 安卓.app.Instrumentation.callActivityOnStart(Instrumentation.java:1236)
   at 安卓.app.Activity.performStart(Activity.java:6006)
   at 安卓.app.ActivityThread.performLaunchActivity(ActivityThread.java:2288)
   at 安卓.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)
   at 安卓.app.ActivityThread.access$800(ActivityThread.java:151)
   at 安卓.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)
   at 安卓.os.Handler.dispatchMessage(Handler.java:102)
   at 安卓.os.Looper.loop(Looper.java:135)
   at 安卓.app.ActivityThread.main(ActivityThread.java:5254)
   at java.lang.reflect.Method.invoke(Method.java)
   at java.lang.reflect.Method.invoke(Method.java:372)
   at com.安卓.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
   at com.安卓.internal.os.ZygoteInit.main(ZygoteInit.java:698)

共 (0) 个答案