上载到Google Playstore后出现错误

时间:2018-12-19 06:47:06

标签: android

当我使用Android Studio运行应用时,我的应用可以完美运行。

将应用程序上载到Playstore时,我开始出现以下错误:

12-19 13:42:14.971 18767-18767/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.djulie.acs.djulie_driver_new, PID: 18767
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.djulie.acs.djulie_driver_new/com.djulie.acs.djulie_driver_new.Menu.MainMenu}: android.view.InflateException: Binary XML file line #0: Binary XML file line #0: Error inflating class ImageView
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3255)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3351)
    at android.app.ActivityThread.access$1100(ActivityThread.java:222)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1796)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:158)
    at android.app.ActivityThread.main(ActivityThread.java:7230)
    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)
 Caused by: android.view.InflateException: Binary XML file line #0: Binary XML file line #0: Error inflating class ImageView
    at android.view.LayoutInflater.inflate(LayoutInflater.java:551)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:429)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:380)
    at android.support.v7.app.ae.b(Unknown Source)
    at android.support.v7.app.p.setContentView(Unknown Source)
    at com.djulie.acs.djulie_driver_new.Menu.MainMenu.onCreate(Unknown Source)

我已将此代码添加到OnCreate事件方法中,但仍无法正常工作

AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);

在此先感谢您的帮助。

2 个答案:

答案 0 :(得分:0)

您必须像这样添加AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);

public class Login extends AppCompatActivity {

static {
    AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
}

//then your onCreate method will be start
 @Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_login);

答案 1 :(得分:0)

通过删除ProGuard解决的问题