Android 更新appcompat API版本后签名的APK崩溃
我用所有相应的库将compileSDK API版本从22改为25。现在我的签名应用程序崩溃了 这是我的名字:Android 更新appcompat API版本后签名的APK崩溃,android,android-appcompat,Android,Android Appcompat,我用所有相应的库将compileSDK API版本从22改为25。现在我的签名应用程序崩溃了 这是我的名字: 02-25 11:52:07.407 23491-23491/? E/AndroidRuntime: FATAL EXCEPTION: main Process: com.App.Main, PID: 23491
02-25 11:52:07.407 23491-23491/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.App.Main, PID: 23491
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.App.Main/com.package.Main.MainActivity}: android.view.InflateException: Binary XML file line #88: Binary XML file line #88: Error inflating class Button
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2702)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2788)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1503)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6209)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
Caused by: android.view.InflateException: Binary XML file line #88: Binary XML file line #88: Error inflating class Button
Caused by: android.view.InflateException: Binary XML file line #88: Error inflating class Button
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void tv.a()' on a null object reference
at android.support.v7.widget.AppCompatButton.setBackgroundDrawable(SourceFile:88)
at android.view.View.setBackground(View.java:18187)
at android.view.View.<init>(View.java:4584)
at android.widget.TextView.<init>(TextView.java:710)
at android.widget.Button.<init>(Button.java:109)
at android.widget.Button.<init>(Button.java:105)
at android.support.v7.widget.AppCompatButton.<init>(SourceFile:66)
at android.support.v7.widget.AppCompatButton.<init>(SourceFile:62)
at pg.a(SourceFile:14109)
at gh.onCreateView(SourceFile:47)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:769)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:727)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:858)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:861)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
at android.view.LayoutInflater.inflate(LayoutInflater.java:518)
at android.view.LayoutInflater.inflate(LayoutInflater.java:426)
at android.view.LayoutInflater.inflate(LayoutInflater.java:377)
at pg.b(SourceFile:288)
at android.support.v7.app.AppCompatActivity.setContentView(SourceFile:140)
at com.package.Main.MainActivity.onCreate(SourceFile:113)
at android.app.Activity.performCreate(Activity.java:6745)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1134)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2655)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2788)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1503)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6209)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
这是按钮,应用程序已崩溃:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/bg_color"
android:gravity="center_horizontal"
xmlns:ads="http://schemas.android.com/apk/res-auto">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent" >
<Button
android:id="@+id/buttonConnect"
android:layout_width="match_parent"
android:layout_height="@dimen/action_measure_height"
style="@style/YellowButton"
android:layout_marginBottom="@dimen/action_margin_horizontal"
android:layout_marginTop="@dimen/action_margin_horizontal"
android:text="@string/button_connect"/>
<com.google.android.gms.ads.AdView
android:id="@+id/adView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
ads:adSize="SMART_BANNER"
ads:adUnitId="@string/admob_publisher_id"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_alignWithParentIfMissing="true"
android:gravity="center" />
</RelativeLayout>
</LinearLayout>
我尝试了所有的建议,在这个网站上找到的,但没有人工作。
看起来,它会在资源中找到的每个按钮上崩溃。
任何想法,如何解决这个问题?所有类都在一个文件中吗?我所做的只是将API从22更改为25。未签名的应用程序工作正常。是否使用版本控制?你能还原更改吗?我可以还原,但我需要版本25来实现新功能。
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/bg_color"
android:gravity="center_horizontal"
xmlns:ads="http://schemas.android.com/apk/res-auto">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent" >
<Button
android:id="@+id/buttonConnect"
android:layout_width="match_parent"
android:layout_height="@dimen/action_measure_height"
style="@style/YellowButton"
android:layout_marginBottom="@dimen/action_margin_horizontal"
android:layout_marginTop="@dimen/action_margin_horizontal"
android:text="@string/button_connect"/>
<com.google.android.gms.ads.AdView
android:id="@+id/adView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
ads:adSize="SMART_BANNER"
ads:adUnitId="@string/admob_publisher_id"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_alignWithParentIfMissing="true"
android:gravity="center" />
</RelativeLayout>
</LinearLayout>
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
}