I am adding a Toolbar in an Activity in my Library project. In my library AndroidManifest, I am using this theme -
<style name="NoobAppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">#color/colorPrimary</item>
<item name="colorPrimaryDark">#color/colorPrimaryDark</item>
<item name="colorAccent">#color/colorAccent</item>
<item name="toolbarStyle">#style/Widget.AppCompat.Toolbar</item>
</style>
But since it was giving some problem in manifest merger due to conflict in AppTheme, I added the changed the AndroidManifest of my app module to this -
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme"
tools:replace="android:theme"> <!-- This line solves the merger issue -->
However since my Library theme for the Activity is getting replaced by the app module which is still using Theme.AppCompat.Light.DarkActionBar as a parent theme, the default ActionBar is still there and when I try to set the ToolBar as my ActionBar in the library Activity using the following line -
setSupportActionBar(mToolbar);
I am getting the following Exception -
--------- beginning of crash
10-12 02:54:32.171 28558-28558/noob.com.noobfilechooser E/AndroidRuntime: FATAL EXCEPTION: main
Process: noob.com.noobfilechooser, PID: 28558
java.lang.RuntimeException: Unable to start activity ComponentInfo{noob.com.noobfilechooser/com.noob.noobfilechooser.NoobFileActivity}: java.lang.IllegalStateException: This Activity already has an action bar supplied by the window decor. Do not request Window.FEATURE_SUPPORT_ACTION_BAR and set windowActionBar to false in your theme to use a Toolbar instead.
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2434)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2494)
at android.app.ActivityThread.access$900(ActivityThread.java:153)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1347)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5451)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Caused by: java.lang.IllegalStateException: This Activity already has an action bar supplied by the window decor. Do not request Window.FEATURE_SUPPORT_ACTION_BAR and set windowActionBar to false in your theme to use a Toolbar instead.
at android.support.v7.app.AppCompatDelegateImplV9.setSupportActionBar(AppCompatDelegateImplV9.java:199)
at android.support.v7.app.AppCompatActivity.setSupportActionBar(AppCompatActivity.java:130)
at com.noob.noobfilechooser.NoobFileActivity.onCreate(NoobFileActivity.java:60)
at android.app.Activity.performCreate(Activity.java:6323)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1108)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2387)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2494)
at android.app.ActivityThread.access$900(ActivityThread.java:153)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1347)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5451)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
I have tried calling
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
which have no effect on the exception. Is there anything I can do to use Toolbar in my library Activity?
OK, it was really silly. I was setting the theme in my Application element in the library manifest, while I should have been setting it on the Activity instead.
Correct way
<application
android:allowBackup="true"
android:label="#string/app_name"
android:supportsRtl="true">
<activity android:theme="#style/NoobAppTheme"
android:name=".NoobFileActivity">
</activity>
</application>
Wrong way
<application
android:allowBackup="true"
android:label="#string/app_name"
android:theme="#style/NoobAppTheme"
android:supportsRtl="true">
<activity android:name=".NoobFileActivity">
</activity>
</application>
Related
This question already has answers here:
You need to use a Theme.AppCompat theme (or descendant) with this activity
(63 answers)
Closed 4 years ago.
I am running across the following error while launching my app:
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.shantanu.fireaudit, PID: 24098
java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
at android.support.v7.app.AppCompatDelegateImplV9.createSubDecor(AppCompatDelegateImplV9.java:354)
at android.support.v7.app.AppCompatDelegateImplV9.ensureSubDecor(AppCompatDelegateImplV9.java:323)
at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:284)
at android.support.v7.app.AppCompatDialog.setContentView(AppCompatDialog.java:83)
at android.support.v7.app.AlertController.installContent(AlertController.java:231)
at android.support.v7.app.AlertDialog.onCreate(AlertDialog.java:278)
at android.app.Dialog.dispatchOnCreate(Dialog.java:389)
at android.app.Dialog.show(Dialog.java:293)
at com.example.shantanu.fireaudit.MainGroupActivity$1.onClick(MainGroupActivity.java:79)
at android.view.View.performClick(View.java:5610)
at android.view.View$PerformClick.run(View.java:22265)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6077)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756)
Here is my AndroidManifest.xml where all activities with corresponding themes are defined.
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".GuidelinesActivity" />
<activity android:name=".FormActivity" />
<activity android:name=".MainGroupActivity"/>
<activity android:name=".LocationsActivity"/>
<activity
android:name=".Main2Activity"
android:label="#string/title_activity_main2"
android:theme="#style/AppTheme"></activity>
</application>
I think it has something to do with the Theme but can't figure it out.
In your res/values/style.xml the style AppTheme should be a Theme.AppCompat theme. For example:
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="colorPrimary">#color/colorPrimary</item>
<item name="colorPrimaryDark">#color/colorPrimaryDark</item>
<item name="colorAccent">#color/colorAccent</item>
</style>
Also make sure you are importing the android appcompat library in your app/build.gradle file.
dependencies {
implementation "com.android.support:appcompat-v7:27.1.1"
}
Facebook SDK version 4.27.0
Android OS version 8.0
App crashes with exception, this is the trace log I have found over Crashlytics:
Fatal Exception: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.xxx.yyy/com.facebook.FacebookActivity}: java.lang.IllegalStateException: Only fullscreen opaque activities can request orientation
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2822)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2897)
at android.app.ActivityThread.-wrap11(Unknown Source)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1598)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:251)
at android.app.ActivityThread.main(ActivityThread.java:6563)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
Caused by java.lang.IllegalStateException: Only fullscreen opaque activities can request orientation
at android.app.Activity.onCreate(Activity.java:986)
at android.support.v4.app.SupportActivity.onCreate(SupportActivity.java:66)
at android.support.v4.app.FragmentActivity.onCreate(FragmentActivity.java:285)
at com.facebook.FacebookActivity.onCreate(FacebookActivity.java:62)
at android.app.Activity.performCreate(Activity.java:6975)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2775)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2897)
at android.app.ActivityThread.-wrap11(Unknown Source)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1598)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:251)
at android.app.ActivityThread.main(ActivityThread.java:6563)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
Can anyone help me with this ?
PS:
In Android Source, after looking at this line number 987, it seems that this line is the culprit.
https://android.googlesource.com/platform/frameworks/base.git/+/master/core/java/android/app/Activity.java#1002
Also, in my manifest:
<activity
android:name="com.facebook.FacebookActivity"
android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
android:label="#string/app_name"
android:screenOrientation="portrait" />
Removing this attribute:
android:screenOrientation="portrait"
from FacebookActivity tag, may solve the problem.
From the latest fb integration guide, we don't need to specify either theme or orientation that is causing crash on android 8.0 . So we should use latest fb sdk with their new settings:
<activity android:name="com.facebook.FacebookActivity"
android:configChanges=
"keyboard|keyboardHidden|screenLayout|screenSize|orientation"
android:label="#string/app_name" />
https://developers.facebook.com/docs/facebook-login/android/#manifest
When i removed this <item name="android:windowIsTranslucent">true</item> from style problem was solved.
remove this line from your style menu
<item name="android:windowIsTranslucent">true</item>
Changed
<style name="AppTheme" parent="android:Theme.Translucent.NoTitleBar"></style>`
to
<style name="AppTheme" parent="android:Theme.Holo.NoActionBar.TranslucentDecor"></style>
then remove
<item name="android:windowIsTranslucent">true</item>
In Android O and later this error happens when you set
android:screenOrientation="portrait"
This code is written in the AndroidManifest file:
<activity
android:name="com.google.android.gms.ads.AdActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
android:screenOrientation="portrait"
android:theme="#android:style/Theme.Translucent"></activity>
Remove this from manifest file
android:screenOrientation="portrait"
and add below code to activity in oncreate before setContentView :
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
This will fix illegalStateException issue/
In the Facebook Developer documentation :
If you use version 5.15 or later of the Facebook SDK for Android, you
don't need to to add an activity or intent filter for Chrome Custom
Tabs. This functionality is included in the SDK.
The problem is caused by :
android:screenOrientation="portrait"
and the presence of :
<item name="android:windowIsTranslucent">true</item>
So if you remove this declaration from your Manifest, it should works:
<activity android:name="com.facebook.FacebookActivity" android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation" android:screenOrientation="sensorPortrait" android:label="#string/app_name"/>
<activity android:name="com.facebook.CustomTabActivity" android:screenOrientation="sensorPortrait" android:exported="true">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="#string/fb_login_scheme" />
</intent-filter>
</activity>
I was tried to remove system white splash before actual splash screen on application start.
I follow this topic: How To fix white screen on app Start up? and created translucent style for splash activity:
<style name="Splash" parent="#android:style/Theme.Translucent">
<item name="windowNoTitle">true</item>
<item name="windowActionBar">false</item>
<item name="android:windowFullscreen">true</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowContentOverlay">#null</item>
<item name="android:windowDisablePreview">true</item>
</style>
But at first launch after the installation, application crashed with the following unhandled exception:
E/AndroidRuntime: FATAL EXCEPTION: main
Process: ru.perekrestok.app, PID: 13791
java.lang.IllegalArgumentException: reportSizeConfigurations: ActivityRecord not found for: Token{5b77a38 null}
at android.os.Parcel.readException(Parcel.java:1687)
at android.os.Parcel.readException(Parcel.java:1636)
at android.app.ActivityManagerProxy.reportSizeConfigurations(ActivityManagerNative.java:6844)
at android.app.ActivityThread.reportSizeConfigurations(ActivityThread.java:2768)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2711)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1460)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6077)
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)
After first launch application starts normally. Can I fix this behaviour? I'm using latest android support library, if this is important
Change you activity entry in manifest with this. This will remove the white splash( as the theme is translucent) & your actual splash will be visible.
<activity
android:name=".SplashActivity"
android:label="#string/app_name"
android:screenOrientation="portrait"
android:theme="#android:style/Theme.Translucent.NoTitleBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Hello I' making this project in Android when i start the dialog Activity from Main Activity.
These are the related files:
Main Activity:http://pastebin.com/xyDbBSj4
Dialogs Activity:http://pastebin.com/f6jGC1CH
I have this error on logcat:
FATAL EXCEPTION: main
Process: com.android4dev.navigationview, PID: 30736
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.android4dev.navigationview/com.android4dev.navigationview.ui.activities.DialogsActivity}:
java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2325)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)
at android.app.ActivityThread.access$800(ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5254)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
Caused by: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
at android.support.v7.app.AppCompatDelegateImplBase.onCreate(AppCompatDelegateImplBase.java:122)
at android.support.v7.app.AppCompatDelegateImplV7.onCreate(AppCompatDelegateImplV7.java:146)
at android.support.v7.app.AppCompatActivity.onCreate(AppCompatActivity.java:59)
at com.android4dev.navigationview.ui.activities.BaseActivity.onCreate(BaseActivity.java:36)
at com.android4dev.navigationview.ui.activities.DialogsActivity.onCreate(DialogsActivity.java:43)
1- You should declare that your application will be stylized using Theme.AppCompat in your Android Manifest.
Something like this:
<activity
android:name=".my.packageactivity.MyOwnActivity"
android:label="#string/app_name"
android:theme="#style/Theme.AppCompat"/>
2- Or maybe declare that the whole application will be stylized using AppCompat.
<application
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:theme="#style/Theme.AppCompat">
3- If you want to set your own style later, you'll have to create a style.xml.
3.1- Using the whole application:
<application
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:theme="#style/MyOwnStyle">
3.2- Using the activity>
<activity
android:name=".my.packageactivity.MyOwnActivity"
android:label="#string/app_name"
android:theme="#style/MyOwnStyle"/>
And then set the parent to Theme.AppCompat inside your new style.xml file:
<resources>
<style name="MyOwnStyle" parent="Theme.AppCompat">
[...]
</style>
</resources>
Config:
Android Studio 1.4 Preview 2
compileSdkVersion 23
buildToolsVersion '23'
minSdkVersion 15
targetSdkVersion 23
Up-to-date support libraries (v23)
Error: [updated]
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.myapp.android.debug/com.myapp.mobile.activities.HomeActivity}: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2416)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Caused by: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
at android.support.v7.app.k.onCreate(AppCompatDelegateImplBase.java:124)
at android.support.v7.app.AppCompatDelegateImplV7.onCreate(AppCompatDelegateImplV7.java:146)
at android.support.v7.app.AppCompatActivity.onCreate(AppCompatActivity.java:59)
at com.myapp.mobile.activities.BaseActivity.onCreate(BaseActivity.java:47)
at com.myapp.mobile.activities.HomeActivity.onCreate(HomeActivity.java:57)
at android.app.Activity.performCreate(Activity.java:6237)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
My application was working well before switching to v23 (previous config was v22 and support libraries v22.2.1. After upgrading, compilation is done correctly but this error appears just at launch.
I have seen many posts on SO where the problem comes from a bad styling, with a Holo parent. Tricky problem found their origin in Manifest file, where an activity theme overrides app theme.
It's my case, so I changed for test purpose my manifest to:
<application
android:name=".MyApplication"
android:allowBackup="true"
android:hardwareAccelerated="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:largeHeap="true"
android:theme="#style/Theme.BaseMyApp">
<!-- Launch activity. MyApp.Theme has Theme.BaseMyApp for parent, but has 2 more attributes for v21 -->
<activity
android:name=".activities.HomeActivity"
android:launchMode="singleTop"
android:theme="#style/MyApp.Theme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
... but, how strange, the error still occurs! I also have checked views of activity layout, but nothing seems to be a problem, only a Toolbar which theme extends AppCompat:
toolbar_layout.xml
<merge xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:fitsSystemWindows="true"
android:theme="#style/AppTheme.Toolbar"
app:subtitleTextAppearance="#style/AppTheme.Toolbar.SubTitle"
app:titleTextAppearance="#style/AppTheme.Toolbar.Title">
<ProgressBar
android:id="#+id/progress_spinner"
style="#style/Widget.MyApp.ActionBar.Progress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:indeterminate="true"
android:visibility="gone" />
</android.support.v7.widget.Toolbar>
where
<style name="AppTheme.Toolbar" parent="ThemeOverlay.AppCompat.ActionBar">
<!-- Customize color of navigation drawer icon and back arrow -->
<item name="colorControlNormal">#android:color/white</item>
</style>
<style name="AppTheme.Toolbar.Title" parent="TextAppearance.Widget.AppCompat.Toolbar.Title">
<!-- Set proper title size -->
<item name="android:textSize">#dimen/abc_text_size_title_material_toolbar</item>
<!-- Set title color -->
<item name="android:textColor">#android:color/white</item>
</style>
<style name="AppTheme.Toolbar.SubTitle" parent="TextAppearance.Widget.AppCompat.Toolbar.Subtitle">
<!-- Set proper title size -->
<item name="android:textSize">#dimen/abc_text_size_subtitle_material_toolbar</item>
<!-- Set title color -->
<item name="android:textColor">#android:color/white</item>
</style>
<style name="Widget.MyApp.ActionBar.Progress" parent="Widget.AppCompat.ProgressBar">
<item name="android:minHeight">25dp</item>
<item name="android:maxHeight">25dp</item>
</style>
Do you have an idea where I have messed it up?
Thanks
Problem partially solved.
The guilty line is:
at android.support.v7.app.k.onCreate(AppCompatDelegateImplBase.java:124)
I use these separate ProGuard files to configure ProGuard. Maybe I didn't point to the correct /app/proguard directory. Thus, ProGuard ignored myapp-rules.pro where I say to keep those android.support.v7.**classes.
After fixing this, I had the error:
:app:proguardDebug
Warning: com.paypal.android.sdk.aT: can't find referenced field 'org.apache.http.HttpEntity wrappedEntity' in program class com.paypal.android.sdk.aT
Warning: uk.co.senab.photoview.PhotoViewAttacher: can't find referenced method 'float sqrt(float)' in library class android.util.FloatMath
Warning: uk.co.senab.photoview.gestures.CupcakeGestureDetector: can't find referenced method 'float sqrt(float)' in library class android.util.FloatMath
Warning: there were 1 unresolved references to program class members.
Your input classes appear to be inconsistent.
You may need to recompile the code.
(http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedprogramclassmember)
Warning: there were 2 unresolved references to library class members.
You probably need to update the library versions.
(http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedlibraryclassmember)
Exception while processing task java.io.IOException: Please correct the above warnings first.
at proguard.Initializer.execute(Initializer.java:473)
at proguard.ProGuard.initialize(ProGuard.java:233)
at proguard.ProGuard.execute(ProGuard.java:98)
at proguard.gradle.ProGuardTask.proguard(ProGuardTask.java:1074)
at com.android.build.gradle.tasks.AndroidProGuardTask.doMinification(AndroidProGuardTask.java:139)
at com.android.build.gradle.tasks.AndroidProGuardTask$1.run(AndroidProGuardTask.java:115)
at com.android.builder.tasks.Job.runTask(Job.java:48)
at com.android.build.gradle.tasks.SimpleWorkQueue$EmptyThreadContext.runTask(SimpleWorkQueue.java:41)
at com.android.builder.tasks.WorkQueue.run(WorkQueue.java:227)
at java.lang.Thread.run(Thread.java:745)
:app:dexDebug
:app:crashlyticsStoreDeobsDebug
:app:crashlyticsUploadDeobsDebug
:app:validateDebugSigning
:app:packageDebug FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:packageDebug'.
> Unable to compute hash of
/home/guillaume/workspace/MyApp/app/build/intermediates/classes-proguard/debug/classes.jar
So I 'fixed' the warnings by adding rules
-dontwarn com.paypal.android.sdk.**
-dontwarn uk.co.senab.photoview.**
Yet the problem seems deeper, as PhotoView and Braintree/Card.io (also PayPal SDK) use methods removed with API 23. The ball is not in my count, is it?
Thanks for your update. Maybe your toolbar parent is the problem. It has another inheritance than Theme.AppCompat.
<style name="AppTheme.Toolbar" parent="ThemeOverlay.AppCompat.ActionBar">
<!-- Customize color of navigation drawer icon and back arrow -->
<item name="colorControlNormal">#android:color/white</item>
</style>
Try using this for your toolbar:
"Widget.AppCompat.Toolbar"
as parent