当我发布带有 ofuscation 剂量的应用程序时,错误充气类按钮。仅伴有脓肿



我的应用程序非常简单,正如您在代码中看到的那样,我几乎没有依赖项。它只抛出异常,如果我使用混淆使ture minifyenable。对不起,我的英语不好。

My gradle here:

android {
compileSdkVersion 25
defaultConfig {
applicationId "cu..."
minSdkVersion 15
targetSdkVersion 25
versionCode 220
versionName "2.2.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
//noinspection GradleDependency
implementation 'com.android.support:appcompat-v7:25.3.1'
//noinspection GradleDependency
implementation 'com.android.support:design:25.3.1'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
}

一些常用的XML:

<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout 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:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:openDrawer="start">
<include
layout="@layout/app_bar_main"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<android.support.design.widget.NavigationView
android:id="@+id/nav_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
app:itemTextColor="@color/colorPrimary"
android:fitsSystemWindows="true"
app:headerLayout="@layout/nav_header_main"
app:menu="@menu/activity_main_drawer" />
</android.support.v4.widget.DrawerLayout>

Style.xml:

<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<style name="AppTheme1" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="colorPrimary">#d74c91</item>
<item name="colorPrimaryDark">#b6065d</item>
<item name="colorAccent">#eefb20</item>
</style>
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
</resources>

风格- 21. - xml:

<resources>
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="android:statusBarColor">@color/colorPrimaryDark</item>
</style>
</resources>

我已经看到了一些答案,但不适合我,因为它只发生在我使用混淆。

谢谢,已经用这个规则解决了:

-keep public class android.support.v7.widget.** { *; }
-keep public class android.support.v7.internal.widget.** { *; } 
-keep public class android.support.v7.internal.view.menu.**

最新更新