Karumi / Dexter

Android library that simplifies the process of requesting permissions at runtime.
http://karumi.com
Apache License 2.0
5.23k stars 670 forks source link

Theme.Transparent Namespace collisions can cause app crashes #160

Closed EmmettWilson closed 7 years ago

EmmettWilson commented 7 years ago

I use Dexter and another third party library that both have Theme.Transparent. The other sdk expected Theme.Transparent to be a child of an Appcompat Theme, and Dexter uses a non Appcompat theme. When the merged manifest is created one of the Theme.Transparent wins based upon ordering. When Dexter's theme wins it causes our app to crash within the other SDK with a java.lang.IllegalArgumentException: You need to use a Theme.AppCompat theme (or descendant) with the design library.

values.xml from Other sdk

  <style name="Theme.Transparent" parent="Theme.AppCompat">
  <item name="android:windowIsTranslucent">true</item>
  <item name="android:windowBackground">@android:color/transparent</item>
  <item name="android:windowContentOverlay">@null</item>
  <item name="android:windowNoTitle">true</item>
  <item name="android:backgroundDimEnabled">false</item>
  </style>

values.xml from Dexter

 <style name="Theme.Transparent" parent="android:Theme">
  <item name="android:windowIsTranslucent">true</item>
  <item name="android:windowBackground">@android:color/transparent</item>
  <item name="android:windowContentOverlay">@null</item>
  <item name="android:windowNoTitle">true</item>
  <item name="android:windowIsFloating">true</item>
  <item name="android:backgroundDimEnabled">false</item>
</style>

I suggest changing the name of the theme within the Dexter to be something more unique than Theme.Transparent so there is less possibility of name collisions as this name is common name among StackOverflow answers. https://stackoverflow.com/questions/2176922/how-do-i-create-a-transparent-activity-on-android https://stackoverflow.com/questions/17542517/activity-with-transparent-background

Serchinastico commented 7 years ago

Hi @EmmettWilson ,

Big woops from our side, we'll merge and release a new version with your PR included today.

Thank you very much for reporting and the solution :clap: .