Я только что загрузил свое приложение в магазин Google Play, и он вылетает из-за следующего кода

 Process: com.trifidresearch.trplsg, PID: 30335
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.trifidresearch.trplsg/com.trifidresearch.trplsg.intro.Country}: android.view.InflateException: Binary XML file line #36: Binary XML file line #36: Error inflating class android.support.v7.widget.Toolbar
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2423)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2483)
    at android.app.ActivityThread.access$900(ActivityThread.java:153)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1349)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:148)
    at android.app.ActivityThread.main(ActivityThread.java:5438)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:739)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:629)
 Caused by: android.view.InflateException: Binary XML file line #36: Binary XML file line #36: Error inflating class android.support.v7.widget.Toolbar
    at android.view.LayoutInflater.inflate(LayoutInflater.java:543)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:427)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
    at android.support.v7.app.am.v(Unknown Source)
    at android.support.v7.app.am.b(Unknown Source)
    at android.support.v7.app.x.setContentView(Unknown Source)
    at com.trifidresearch.trplsg.intro.Country.onCreate(Unknown Source)
    at android.app.Activity.performCreate(Activity.java:6303)
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1108)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2376)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2483) 
    at android.app.ActivityThread.access$900(ActivityThread.java:153) 
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1349) 
    at android.os.Handler.dispatchMessage(Handler.java:102) 
    at android.os.Looper.loop(Looper.java:148) 
    at android.app.ActivityThread.main(ActivityThread.java:5438) 
    at java.lang.reflect.Method.invoke(Native Method) 
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:739) 
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:629) 
 Caused by: android.view.InflateException: Binary XML file line #36: Error inflating class android.support.v7.widget.Toolbar
    at android.view.LayoutInflater.createView(LayoutInflater.java:649)
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:768)
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:708)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:839)
    at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:802)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:842)
    at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:802)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:519)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:427) 
    at android.view.LayoutInflater.inflate(LayoutInflater.java:374) 
    at android.support.v7.app.am.v(Unknown Source) 
    at android.support.v7.app.am.b(Unknown Source) 
    at android.support.v7.app.x.setContentView(Unknown Source) 
    at com.trifidresearch.trplsg.intro.Country.onCreate(Unknown Source) 
    at android.app.Activity.performCreate(Activity.java:6303) 
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1108) 
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2376) 
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2483) 
    at android.app.ActivityThread.access$900(ActivityThread.java:153) 
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1349) 
    at android.os.Handler.dispatchMessage(Handler.java:102) 
    at android.os.Looper.loop(Looper.java:148) 
    at android.app.ActivityThread.main(ActivityThread.java:5438) 
    at java.lang.reflect.Method.invoke(Native Method) 
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:739) 
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:629) 
 Caused by: java.lang.reflect.InvocationTargetException
    at java.lang.reflect.Constructor.newInstance(Native Method)
    at android.view.LayoutInflater.createView(LayoutInflater.java:623)
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:768) 
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:708) 
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:839) 
    at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:802) 
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:842) 
    at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:802) 
    at android.view.LayoutInflater.inflate(LayoutInflater.java:519) 
    at android.view.LayoutInflater.inflate(LayoutInflater.java:427) 
    at android.view.LayoutInflater.inflate(LayoutInflater.java:374) 
    at android.support.v7.app.am.v(Unknown Source) 
    at android.support.v7.app.am.b(Unknown Source) 
    at android.support.v7.app.x.setContentView(Unknown Source) 
    at com.trifidresearch.trplsg.intro.Country.onCreate(Unknown Source) 
    at android.app.Activity.performCreate(Activity.java:6303) 
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1108) 
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2376) 
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2483) 
    at android.app.ActivityThread.access$900(ActivityThread.java:153) 
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1349) 
    at android.os.Handler.dispatchMessage(Handler.java:102) 
    at android.os.Looper.loop(Looper.java:148) 
    at android.app.ActivityThread.main(ActivityThread.java:5438) 
    at java.lang.reflect.Method.invoke(Native Method) 
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:739) 
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:629) 
 Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.support.v7.widget.aj.a()' on a null object reference
    at android.support.v7.widget.at.setBackgroundDrawable(Unknown Source)
    at android.view.View.setBackground(View.java:17244)
    at android.view.View.<init>(View.java:4337)
    at android.widget.ImageView.<init>(ImageView.java:145)
    at android.widget.ImageButton.<init>(ImageButton.java:84)
    at android.widget.ImageButton.<init>(ImageButton.java:80)
    at android.support.v7.widget.at.<init>(Unknown Source)
    at android.support.v7.widget.Toolbar.y(Unknown Source)
    at android.support.v7.widget.Toolbar.c(Unknown Source)
    at android.support.v7.widget.Toolbar.<init>(Unknown Source)
    at android.support.v7.widget.Toolbar.<init>(Unknown Source)
    at java.lang.reflect.Constructor.newInstance(Native Method) 
    at android.view.LayoutInflater.createView(LayoutInflater.java:623) 
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:768) 
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:708) 
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:839) 
    at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:802) 
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:842) 
    at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:802) 
    at android.view.LayoutInflater.inflate(LayoutInflater.java:519) 
    at android.view.LayoutInflater.inflate(LayoutInflater.java:427) 
    at android.view.LayoutInflater.inflate(LayoutInflater.java:374) 
    at android.support.v7.app.am.v(Unknown Source) 
    at android.support.v7.app.am.b(Unknown Source) 
    at android.support.v7.app.x.setContentView(Unknown Source) 
    at com.trifidresearch.trplsg.intro.Country.onCreate(Unknown Source) 
    at android.app.Activity.performCreate(Activity.java:6303) 
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1108) 
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2376) 
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2483) 
    at android.app.ActivityThread.access$900(ActivityThread.java:153) 
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1349) 
    at android.os.Handler.dispatchMessage(Handler.java:102) 
    at android.os.Looper.loop(Looper.java:148) 
    at android.app.ActivityThread.main(ActivityThread.java:5438) 
    at java.lang.reflect.Method.invoke(Native Method) 
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:739) 
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:629) 
    09-13 11:50:51.764 1585-2906/? E/ActivityManager: Invalid thumbnail dimensions: 0x0

Он отлично работает с эмуляторами и моим телефоном при установке из Android Studio, но как только я загружаю его в магазин воспроизведения, он не запускается.

мой код

package com.trifidresearch.trplsg.intro;
import android.os.Bundle;
import android.os.StrictMode;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AppCompatActivity;
import android.text.Editable;
import android.text.TextWatcher;
import android.widget.EditText;
import android.widget.ListView;

import com.trifidresearch.trplsg.R;

import java.util.ArrayList;
import java.util.Locale;

public class Country extends AppCompatActivity {
    ListView list;
    ListViewAdapter adapter;
    EditText editsearch;
    String[] country;
    ArrayList<CountryNames> arraylist = new ArrayList<CountryNames>();
    @Override
    public void onCreate(Bundle savedInstanceState) {


        StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
                .detectDiskReads()
                .detectDiskWrites()
                .detectNetwork()   // or .detectAll() for all detectable problems
                .detectAll()
                .penaltyLog()
                .build());

        StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder()
                .detectLeakedSqlLiteObjects()
                .detectLeakedClosableObjects()
                .penaltyLog()
                .detectAll()
                .penaltyDeath()
                .build());
    super.onCreate(savedInstanceState);
    setContentView(R.layout.listview_main);
        getSupportActionBar().setBackgroundDrawable(ContextCompat.getDrawable(getApplicationContext(), R.drawable.gradi));
    country = new String[] {
            "AFGHANISTAN(93)",
            "ALBANIA(355)",
            "ALGERIA(213)",
            "AMERICAN SAMOA(1684)",
            "ANDORRA(376)",
            "ANGOLA(244)",
            "ZIMBABWE(263)"
    };
    list = findViewById(R.id.listview);
    for (int i = 0; i < country.length; i++)
    {
        CountryNames wp = new CountryNames(country[i]);
        arraylist.add(wp);
    }
    adapter = new ListViewAdapter(this, arraylist);
    list.setAdapter(adapter);
    editsearch = findViewById(R.id.search);
    editsearch.addTextChangedListener(new TextWatcher() {
        @Override
        public void afterTextChanged(Editable arg0) {
            String text = editsearch.getText().toString().toLowerCase(Locale.getDefault());
            adapter.filter(text);
        }
        @Override
        public void beforeTextChanged(CharSequence arg0, int arg1,
                                      int arg2, int arg3) {
        }
        @Override
        public void onTextChanged(CharSequence arg0, int arg1, int arg2,
                                  int arg3) {
        }
    });
}

Мой идентификатор файла gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 27
    buildToolsVersion '27.0.3'
    defaultConfig {
        vectorDrawables.useSupportLibrary = true
        applicationId 'com.trifidresearch.trplsg'
        minSdkVersion 19
        targetSdkVersion 27
        versionCode 20201
        versionName '2.2.1'
        useLibrary 'org.apache.http.legacy'
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    splits {
        abi {
            enable true
            reset()
            include 'x86_64', 'x86', 'armeabi', 'armeabi-v7a', 'arm64-v8a', 'mips'
            //select ABIs to build APKs for
            universalApk true //generate an additional APK that contains all the ABIs
        }
    }
    buildTypes {
        release {
            minifyEnabled true
            shrinkResources true
            // proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), "proguard-rules.pro"
            debuggable false
            jniDebuggable false
            renderscriptDebuggable false
            // signingConfig playStoreConfig //Add your own signing config
            pseudoLocalesEnabled false
            zipAlignEnabled true
        }
        debug {

        }
    }
    productFlavors {
    }
    lintOptions {
        checkReleaseBuilds false
    }
    aaptOptions {
        cruncherEnabled = true
    }
    buildToolsVersion '27.0.3'
}


ext.versionCodes = ['armeabi': 1, 'armeabi-v7a': 2, 'arm64-v8a': 3, 'mips': 4, 'x86': 5, 'x86_64': 6]

android.applicationVariants.all { variant ->

    variant.outputs.each { output ->
        output.versionCodeOverride = android.defaultConfig.versionCode * 10000 + project.ext.versionCodes.get(output.getFilter(com.android.build.OutputFile.ABI), 0)
    }
}



dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support:design:27.1.1'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'com.google.firebase:firebase-messaging:11.8.0'
    implementation 'com.android.volley:volley:1.0.0'
    implementation 'com.android.support:support-v4:27.1.1'
    implementation 'com.android.support:cardview-v7:27.1.1'
    implementation 'com.getbase:floatingactionbutton:1.10.1'
    implementation 'com.github.clans:fab:1.6.4'
    implementation 'com.android.support:recyclerview-v7:27.1.1'
    implementation 'com.paypal.sdk:paypal-android-sdk:2.14.2'
    implementation 'org.jsoup:jsoup:1.10.3'
    implementation 'io.github.sac:SocketclusterClientJava:1.7.5'
    implementation 'com.github.bumptech.glide:glide:3.8.0'
    implementation 'com.loopj.android:android-async-http:1.4.9'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}

apply plugin: 'com.google.gms.google-services'
-2
Amit Kumar Pawar 13 Сен 2018 в 09:31

2 ответа

Лучший ответ

Если вы установите Proguard minifyEnabled на true, я бы предположил, что это вызывает сбой. Итак, попробуйте добавить их в /app/proguard-rules.pro:

-dontwarn android.support.v7.**
-keep class android.support.v7.** { *; }
-keep interface android.support.v7.** { *; }
-keep class com.google.** { *; }
-keep interface com.google.** { *; }

Это должно помочь, поскольку вы сказали, что уже используете последнюю версию библиотеки поддержки.

1
ʍѳђઽ૯ท 13 Сен 2018 в 07:27

Я думаю, ваша проблема связана с этим возможностью рисования

R.drawable.gradi

Как указано в последней строке вашего журнала ошибок

Недопустимые размеры миниатюры: 0x0.

Пожалуйста, проверьте один раз после удаления.

1
Diwakar Singh 13 Сен 2018 в 07:05