Сбой Android Resource.getValue в моей консоли Google Play Dev без дополнительной информации - PullRequest
0 голосов
/ 22 февраля 2019

Итак, у меня есть приложение для Android, загруженное в Google Play, и, поскольку я обновил его несколько дней назад, у меня было 36 сбоев, но я не могу найти его источник.Когда я тестирую приложение, оно не падает.Это трассировка стека ошибки, которую я получаю, когда захожу в консоль разработчика:

   android.content.res.Resources$NotFoundException:
at android.content.res.Resources.getValue (Resources.java:2598)
  at android.support.v7.widget.AppCompatDrawableManager.loadDrawableFromDelegates (AppCompatDrawableManager.java:331)
  at android.support.v7.widget.AppCompatDrawableManager.getDrawable (AppCompatDrawableManager.java:198)
  at android.support.v7.widget.AppCompatDrawableManager.getDrawable (AppCompatDrawableManager.java:191)
  at android.support.v7.content.res.AppCompatResources.getDrawable (AppCompatResources.java:102)
  at android.support.v7.view.menu.MenuItemImpl.getIcon (MenuItemImpl.java:505)
  at android.support.v7.view.menu.ActionMenuItemView.initialize (ActionMenuItemView.java:126)
  at android.support.v7.widget.ActionMenuPresenter.bindItemView (ActionMenuPresenter.java:211)
  at android.support.v7.view.menu.BaseMenuPresenter.getItemView (BaseMenuPresenter.java:188)
  at android.support.v7.widget.ActionMenuPresenter.getItemView (ActionMenuPresenter.java:197)
  at android.support.v7.widget.ActionMenuPresenter.flagActionItems (ActionMenuPresenter.java:477)
  at android.support.v7.view.menu.MenuBuilder.flagActionItems (MenuBuilder.java:1182)
  at android.support.v7.view.menu.BaseMenuPresenter.updateMenuView (BaseMenuPresenter.java:96)
  at android.support.v7.widget.ActionMenuPresenter.updateMenuView (ActionMenuPresenter.java:230)
  at android.support.v7.view.menu.MenuBuilder.dispatchPresenterUpdate (MenuBuilder.java:298)
  at android.support.v7.view.menu.MenuBuilder.onItemsChanged (MenuBuilder.java:1069)
  at android.support.v7.view.menu.MenuBuilder.startDispatchingItemsChanged (MenuBuilder.java:1096)
  at android.support.v7.app.AppCompatDelegateImpl.preparePanel (AppCompatDelegateImpl.java:1631)
  at android.support.v7.app.AppCompatDelegateImpl.doInvalidatePanelMenu (AppCompatDelegateImpl.java:1869)
  at android.support.v7.app.AppCompatDelegateImpl$2.run (AppCompatDelegateImpl.java:230)
  at android.os.Handler.handleCallback (Handler.java:739)
  at android.os.Handler.dispatchMessage (Handler.java:95)
  at android.os.Looper.loop (Looper.java:148)
  at android.app.ActivityThread.main (ActivityThread.java:7325)
  at java.lang.reflect.Method.invoke (Native Method)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:1230)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1120)

В последнем обновлении я добавил новое действие, которое открывает экран с дополнительной информацией о приложении, поэтомуInfoActivity:

private TextView rateApp;
    private TextView contactUs;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_info);

        rateApp = findViewById(R.id.rateAppTv);
        contactUs = findViewById(R.id.sendEmailTv);
        rateApp.setMovementMethod(LinkMovementMethod.getInstance());
        rateApp.setPaintFlags(rateApp.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
        contactUs.setPaintFlags(contactUs.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);

        contactUs.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent emailIntent = new Intent(Intent.ACTION_SENDTO);
                emailIntent.setData(Uri.parse("mailto:natasa.andzic1@gmail.com"));
                emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Rick and Morty soundboard app feedback");
                if (emailIntent.resolveActivity(getPackageManager()) != null)
                    startActivity(emailIntent);
            }
        });

        rateApp.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                openAppRating(InfoActivity.this);       }
        });
    }

    public static void openAppRating(Context context) {
        // you can also use BuildConfig.APPLICATION_ID
        String appId = context.getPackageName();
        Intent rateIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + appId));
        boolean marketFound = false;

        // find all applications able to handle our rateIntent
        final List<ResolveInfo> otherApps = context.getPackageManager()
                .queryIntentActivities(rateIntent, 0);
        for (ResolveInfo otherApp: otherApps) {
            // look for Google Play application
            if (otherApp.activityInfo.applicationInfo.packageName.equals("com.android.vending")) {

                ActivityInfo otherAppActivity = otherApp.activityInfo;
                ComponentName componentName = new ComponentName(otherAppActivity.applicationInfo.packageName, otherAppActivity.name
                );
                // make sure it does NOT open in the stack of your activity
                rateIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                // task reparenting if needed
                rateIntent.addFlags(Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
                // if the Google Play was already open in a search result
                //  this make sure it still go to the app page you requested
                rateIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
                // this make sure only the Google Play app is allowed to
                // intercept the intent
                rateIntent.setComponent(componentName);
                context.startActivity(rateIntent);
                marketFound = true;
                break;

            }
        }

        // if GP not present on device, open web browser
        if (!marketFound) {
            Intent webIntent = new Intent(Intent.ACTION_VIEW,
                    Uri.parse("https://play.google.com/store/apps/details?id="+appId));
            context.startActivity(webIntent);
        }
    }
}

и activity_info.xml:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:background="@color/colorAccent"
    tools:context=".InfoActivity">

    <View
        style="@style/info_separator_style"
        android:background="@color/colorPrimaryLight" />

    <TextView
        android:id="@+id/rateTv"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:textStyle="bold"
        android:layout_marginTop="20dp"
        android:text="Rate this app"
        android:textColor="#000000"
        android:textSize="36sp" />


    <TextView
        android:autoLink="web"
        android:textStyle="italic"
        android:id="@+id/rateAppTv"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:text="Click here"
        android:textColor="#000000"
        android:textSize="24sp" />
    <View
        android:layout_marginTop="20dp"
        style="@style/info_separator_style"
        android:background="@color/colorPrimaryLight" />

    <TextView
        android:layout_marginTop="20dp"
        android:layout_gravity="center"
        android:text="Contact us!"
        android:textStyle="bold"
        android:textSize="36sp"
        android:layout_width="wrap_content"
        android:textColor="#000000"
        android:layout_height="wrap_content" />

    <TextView
        android:layout_gravity="center"
        android:textSize="24sp"
        android:textColor="#000000"
        android:textStyle="italic"
        android:id="@+id/sendEmailTv"
        android:text="Click here to send us an email!"
        style="@style/RtlUnderlay.Widget.AppCompat.ActionButton"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />

    <View
        android:layout_marginTop="20dp"
        style="@style/info_separator_style"
        android:background="@color/colorPrimaryLight" />

    <TextView
        android:layout_marginTop="20dp"
        android:layout_gravity="center"
        android:text="About"
        android:textStyle="bold"
        android:textSize="36sp"
        android:layout_width="wrap_content"
        android:textColor="#000000"
        android:layout_height="wrap_content" />

    <TextView
        android:layout_gravity="center"
        android:textSize="24sp"
        android:textColor="#000000"
        android:textStyle="italic"
        android:id="@+id/jaTv"
        android:text="Made by Nataša Andžić"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />

    <View
        android:layout_marginTop="20dp"
        style="@style/info_separator_style"
        android:background="@color/colorPrimaryLight" />

    <TextView
        android:layout_marginTop="20dp"
        android:layout_gravity="center"
        android:text="Thanks"
        android:textStyle="bold"
        android:textSize="36sp"
        android:layout_width="wrap_content"
        android:textColor="#000000"
        android:layout_height="wrap_content" />

    <TextView
        android:layout_gravity="center"
        android:textSize="24sp"
        android:textColor="#000000"
        android:textStyle="italic"
        android:id="@+id/thanksTv"
        android:text="Icons - Material Design"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />

</LinearLayout>

1 Ответ

0 голосов
/ 22 февраля 2019

проблема связана с нарисованным файлом.если вы поместили какой-либо из ваших нарисованных файлов в drawable-v24, то это приведет к ошибке в следующих версиях API.

см. этот ответ возможно, это поможет вам

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...