Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-apps-script/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android Sncabar文本未显示在带有proguard的签名APK上_Android_Android Snackbar - Fatal编程技术网

Android Sncabar文本未显示在带有proguard的签名APK上

Android Sncabar文本未显示在带有proguard的签名APK上,android,android-snackbar,Android,Android Snackbar,为什么Snacbar文本不显示在签名的APK上?下面是调试APK的代码。我还启用了proguard。这种情况发生是因为proguard吗 if (intent.hasExtra(KEY_ERROR_MESSAGE)) { String msg = intent.getStringExtra(KEY_ERROR_MESSAGE); Snackbar snack = Snackbar.make(findViewById(android.R.id.content), msg,

为什么Snacbar文本不显示在签名的APK上?下面是调试APK的代码。我还启用了proguard。这种情况发生是因为proguard吗

  if (intent.hasExtra(KEY_ERROR_MESSAGE)) {
     String msg = intent.getStringExtra(KEY_ERROR_MESSAGE);
     Snackbar snack = Snackbar.make(findViewById(android.R.id.content), msg, Snackbar.LENGTH_LONG);

     View view = snack.getView();
     view.setBackgroundColor(ContextCompat.getColor(SignupActivity.this, R.color.red_EC1C24));

     TextView tv = (TextView) view.findViewById(android.support.design.R.id.snackbar_text);
     tv.setTextColor(ContextCompat.getColor(SignupActivity.this, R.color.accent));
     tv.setGravity(Gravity.CENTER_HORIZONTAL);
     snack.show();
  }
编辑:

intent.hasExtra(KEY\u ERROR\u MESSAGE)
return
true
但是
intent.getStringExtra(KEY\u ERROR\u MESSAGE)
return
null
不是预期的
String


我应该使用哪些proguard规则

根据本文:您可能必须将这些异常添加到您的proguard规则文件中:

-dontwarn android.support.design.**
-keep class android.support.design.** { *; }
-keep interface android.support.design.** { *; }
-keep public class android.support.design.R$* { *; }

您是否尝试注释第4行至第9行并测试您的应用程序?并为Snackbar.make()提供另一个视图,而不是android.R.id.content