I completed this move and worked out most of the kinks however there is one problem I've not been able to solve. Did a search and tried to make sense of the results, tried a few things but still no progress. The problem seems to be related to the Styles/Themes in the app.
Stack trace
Process: net.myapp.app.debug, PID: 14927
java.lang.RuntimeException: Unable to start activity ComponentInfo{net.myapp.app.debug/net.myapp.app.ui.SplashSreenActivity}: android.view.InflateException: Binary XML file line #31: Binary XML file line #31: Error inflating class android.widget.TextView
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2817)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2892)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1593)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6541)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
Caused by: android.view.InflateException: Binary XML file line #31: Binary XML file line #31: Error inflating class android.widget.TextView
Caused by: android.view.InflateException: Binary XML file line #31: Error inflating class android.widget.TextView
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:334)
at android.view.LayoutInflater.createView(LayoutInflater.java:647)
at com.android.internal.policy.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:58)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:720)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:788)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:863)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:866)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:418)
at android.app.Activity.setContentView(Activity.java:2654)
at net.shopayard.app.ui.SplashSreenActivity.onCreate(SplashSreenActivity.java:42)
at android.app.Activity.performCreate(Activity.java:6975)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1213)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2770)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2892)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1593)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6541)
at java.lang.reflect.Method.invoke(Native Method)
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.UnsupportedOperationException: Failed to resolve attribute at index 6: TypedValue{t=0x2/d=0x101009b a=1}
at android.content.res.TypedArray.getColorStateList(TypedArray.java:538)
at android.widget.TextView.<init>(TextView.java:904)
at android.widget.TextView.<init>(TextView.java:818)
at android.widget.TextView.<init>(TextView.java:814)
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:334)
at android.view.LayoutInflater.createView(LayoutInflater.java:647)
at com.android.internal.policy.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:58)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:720)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:788)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:863)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:866)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:418)
at android.app.Activity.setContentView(Activity.java:2654)
at net.myapp.app.ui.SplashSreenActivity.onCreate(SplashSreenActivity.java:42)
at android.app.Activity.performCreate(Activity.java:6975)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1213)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2770)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2892)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1593)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6541)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
build.grade (app)
apply plugin: 'com.android.application'
android {
signingConfigs {
debug {
storeFile file('C:/Users/myapp/.android/debug.keystore')
}
}
compileSdkVersion 28
buildToolsVersion "28.0.3"
defaultConfig {
applicationId "net.myapp.app"
minSdkVersion 21
targetSdkVersion 28
versionCode 22
versionName '3.0.0'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
applicationIdSuffix '.debug'
versionNameSuffix '.debug'
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
}
repositories {
flatDir {
dirs 'libs'
}
}
productFlavors {
}
useLibrary 'org.apache.http.legacy'
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:28.0.0'
compile 'com.android.support:recyclerview-v7:28.0.0'
compile 'com.android.support:cardview-v7:28.0.0'
compile 'com.viewpagerindicator:library:2.4.1'
compile 'com.android.support:support-v4:28.0.0'
compile 'com.astuetz:pagerslidingtabstrip:1.0.1'
compile 'com.davemorrissey.labs:subsampling-scale-image-view:2.3.0'
compile('org.apache.httpcomponents:httpmime:4.3.6') {
exclude module: 'httpclient'
}
compile 'org.apache.httpcomponents:httpclient-android:4.3.5'
compile(name: 'analyticslibrary', ext: 'aar')
compile 'com.google.android.gms:play-services-analytics:16.0.4'
}
styles.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="windowActionBar">false</item>
<item name="drawerArrowStyle">@style/DrawerArrowStyle</item>
<item name="colorPrimary">@color/primary_color</item>
<item name="colorPrimaryDark">@color/primary_color_dark</item>
<item name="colorAccent">@color/accent</item>
<item name="actionBarSize">@dimen/abc_action_bar_default_height_material</item>
<item name="colorSwitchThumbNormal">@color/switch_thumb_normal</item>
</style>
<style name="ToolbarThemeOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar">
<item name="android:subtitleTextStyle">@style/SubTitleTextStyle</item>
<item name="subtitleTextStyle">@style/SubTitleTextStyle</item>
</style>
<style name="SubTitleTextStyle">
<item name="android:textStyle">italic</item>
<item name="android:textSize">12sp</item>
<item name="android:textColor">@color/text_white</item>
</style>
<style name="DrawerArrowStyle" parent="Widget.AppCompat.DrawerArrowToggle">
<item name="spinBars">true</item>
<item name="color">@android:color/white</item>
</style>
<style name="SpinnerButton">
<item name="android:minHeight">40dp</item>
<item name="android:layout_marginLeft">@dimen/content_margin_normal</item>
<item name="android:layout_marginRight">@dimen/content_margin_normal</item>
<item name="android:background">@drawable/spinner_button_selector</item>
<item name="android:textColor">@color/text_black</item>
<item name="android:textSize">@dimen/text_size_medium</item>
<item name="android:textStyle">italic</item>
</style>
<style name="EditTextRectangleStyle">
<item name="android:layout_marginLeft">@dimen/content_margin_normal</item>
<item name="android:layout_marginRight">@dimen/content_margin_normal</item>
<item name="android:background">@drawable/black_rectangle</item>
<item name="android:textColor">@color/text_black</item>
<item name="android:textSize">@dimen/text_size_medium</item>
<item name="android:textColorHint">@color/text_gray</item>
<item name="android:textStyle">italic</item>
</style>
<style name="EditTextStyle">
<item name="android:minHeight">40dp</item>
<item name="android:layout_marginLeft">@dimen/content_margin_normal</item>
<item name="android:layout_marginRight">@dimen/content_margin_normal</item>
<item name="android:background">@drawable/edittext_bg</item>
<item name="android:textColor">@color/text_black</item>
<item name="android:textSize">@dimen/text_size_medium</item>
<item name="android:textColorHint">@color/text_gray</item>
<item name="android:textStyle">italic</item>
</style>
<style name="EditTextNoMarginsStyle">
<item name="android:minHeight">40dp</item>
<item name="android:background">@drawable/edittext_bg</item>
<item name="android:textColor">@color/text_black</item>
<item name="android:textSize">@dimen/text_size_medium</item>
<item name="android:textColorHint">@color/text_gray</item>
<item name="android:textStyle">italic</item>
</style>
<style name="FormLabelClickable" parent="FormLabelStyle">
<item name="android:clickable">true</item>
<item name="android:textColor">@color/clickable_black_text</item>
</style>
<style name="FormLabelStyle">
<item name="android:minHeight">40dp</item>
<item name="android:layout_marginLeft">@dimen/content_margin_normal</item>
<item name="android:layout_marginRight">@dimen/content_margin_normal</item>
<item name="android:gravity">center_vertical</item>
<item name="android:textColor">@color/text_black</item>
<item name="android:textSize">@dimen/text_size_medium</item>
<item name="android:textStyle">italic</item>
</style>
<style name="StandardSwitch" parent="FormLabelStyle" >
<item name="android:padding">1dp</item>
<item name="android:textColor">@color/switch_text_dark_gray</item>
</style>
<style name="SwitchLabelStyle">
<item name="android:paddingRight">@dimen/content_margin_normal</item>
<item name="android:textColor">@color/text_gray</item>
<item name="android:textSize">@dimen/text_size_small</item>
</style>
<style name="CustomTabPageIndicator">
<item name="android:background">@color/primary_color</item>
<item name="android:textSize">12sp</item>
<item name="pstsTextAllCaps">true</item>
<item name="android:maxLines">1</item>
<item name="android:textColor">#FFAAAAAA</item>
<item name="pstsIndicatorColor">#FFFFFF</item>
<item name="pstsDividerColor">@android:color/transparent</item>
<item name="pstsShouldExpand">true</item>
<item name="pstsIndicatorHeight">4dp</item>
<item name="pstsTabPaddingLeftRight">1dp</item>
<item name="pstsUnderlineColor">#FFFFFF</item>
<item name="pstsUnderlineHeight">0dp</item>
</style>
<style name="ButtonBar">
<item name="android:paddingLeft">2dp</item>
<item name="android:paddingTop">5dp</item>
<item name="android:paddingRight">2dp</item>
<item name="android:paddingBottom">0dp</item>
<item name="android:background">@android:drawable/bottom_bar</item>
</style>
<style name="dialog_popup_slideout">
<item name="android:windowExitAnimation">@anim/slide_out_dialog</item>
</style>
<style name="dialog_slidein_slideout">
<item name="android:windowEnterAnimation">@anim/slide_in_dialog</item>
</style>
<style name="dialog_slidein_left_slideout">
<item name="android:windowEnterAnimation">@anim/slide_in_left</item>
<item name="android:windowExitAnimation">@anim/slide_out_dialog</item>
</style>
<style name="ButtonBarButton" />
<style name="FullscreenTheme" parent="android:Theme.NoTitleBar">
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowBackground">@null</item>
<item name="metaButtonBarStyle">@style/ButtonBar</item>
<item name="metaButtonBarButtonStyle">@style/ButtonBarButton</item>
</style>
<style name="FullscreenTheme.NoActionBar" parent="ThemeOverlay.AppCompat.Dark.ActionBar">
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowBackground">@null</item>
<item name="metaButtonBarStyle">@style/ButtonBar</item>
<item name="metaButtonBarButtonStyle">@style/ButtonBarButton</item>
<item name="android:windowActionBar">false</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowIsFloating">false</item>
</style>
<style name="NumberPickerDialog" parent="DialogCenteredTitle">
<item name="android:layout_width">280dp</item>
</style>
<style name="DialogCenteredTitle" parent="Base.Theme.AppCompat.Light.Dialog">
<item name="android:windowTitleStyle">@style/CenteredTitle</item>
<item name="colorAccent">@color/accent</item>
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:windowFrame">@null</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:colorBackgroundCacheHint">@null</item>
</style>
<style name="CenteredTitle" parent="Base.TextAppearance.AppCompat.Title">
<item name="android:gravity">center</item>
<item name="android:layout_width">match_parent</item>
<item name="android:layout_gravity">center</item>
<item name="android:layout_marginBottom">8dp</item>
</style>
<style name="RedRectangularButton" parent="BlueRectangularButton">
<item name="android:background">@drawable/red_rectangle_button_bg_selector</item>
</style>
<style name="BlueRectangularButton">
<item name="android:minHeight">40dp</item>
<item name="android:paddingLeft">@dimen/rectangular_button_horizontal_margin</item>
<item name="android:paddingRight">@dimen/rectangular_button_horizontal_margin</item>
<item name="android:textColor">@color/button_text_white</item>
<item name="android:background">@drawable/blue_rectangle_button_bg_selector</item>
<item name="android:textAllCaps">true</item>
</style>
<style name="ImageViewAttachment">
<item name="android:width">0dp</item>
<item name="android:minHeight">@dimen/select_image_min_height</item>
<item name="android:scaleType">fitCenter</item>
<item name="android:background">@drawable/dashed_rectangle_selector</item>
<item name="android:layout_weight">0.25</item>
<item name="android:src">@drawable/symbol_camera</item>
<item name="android:adjustViewBounds">true</item>
</style>
</resources>
activity.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/splash_background"
tools:context="net.myapp.app.ui.SplashSreenActivity">
<ImageView
android:id="@+id/image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/image_menu"
android:layout_alignParentBottom="true"
android:adjustViewBounds="true"
android:scaleType="fitEnd"/>
<ProgressBar
android:id="@+id/progressBar"
style="?android:attr/progressBarStyleLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:visibility="gone"/>
<LinearLayout
android:id="@+id/layoutError"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:gravity="center_horizontal"
android:paddingBottom="100dp"
android:orientation="vertical"
android:visibility="gone">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="16dp"
android:textColor="@color/text_black"
android:gravity="center_horizontal"
android:textSize="16sp"
android:text="@string/error_maintenance"/>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/content_margin_normal">
<Button
android:id="@+id/buttonRetry"
android:layout_width="60dp"
android:layout_height="60dp"
android:textColor="@color/text_white"
android:textSize="12sp"
android:text="@string/retry"
android:background="@drawable/circle_button_blue_selector"/>
<ProgressBar
android:id="@+id/progressBarRetry"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="?android:attr/progressBarStyleSmall"
android:layout_centerInParent="true"
android:visibility="invisible"/>
</RelativeLayout>
</LinearLayout>
</RelativeLayout>
strings.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">myapp</string>
<string name="ic_action_search">Search</string>
<string name="ic_action_profile">Profile</string>
<string name="ic_action_refresh">Refresh</string>
<string name="action_call">Call</string>
<string name="action_email">Email</string>
<string name="action_share">Share</string>
<string name="action_location">Location</string>
<string name="action_report">Report</string>
<string name="navigation_drawer_open">Open navigation drawer</string>
<string name="navigation_drawer_close">Close navigation drawer</string>
<string name="action_settings">Settings</string>
<string name="hello_blank_fragment">Hello blank fragment</string>
<string name="register_below">Register below to receive deals and promotions from local businesses.</string>
<string name="gender">Gender</string>
<string name="birth_year">Year of birth</string>
<string name="island">Island</string>
<string name="button_done">Done</string>
<string name="button_ok">OK</string>
<string name="loading">Loading...</string>
<string name="title_activity_profile">Profile</string>
<string name="title_activity_deals_details">DealsDetailsActivity</string>
<string name="title_activity_fullscreen_image">FullscreenImageActivity</string>
<string name="title_activity_classified_details">ClassifiedDetailsActivity</string>
<string name="title_activity_splash_sreen">SplashSreenActivity</string>
<!-- Splash screen -->
<string name="retry">Retry</string>
<string name="retry_failed">Retry failed</string>
<string name="error_maintenance">The servers are currently undergoing maintenance, please try again in a few minutes.</string>
</resources>
colors.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="primary_color_clicked">#0071a8</color>
<color name="primary_color">#004A77</color>
<color name="primary_color_dark">#004368</color>
<color name="switch_thumb_normal">#004A77</color>
<color name="switch_text_dark_gray">#464646</color>
<color name="accent">#80A4BB</color>
<color name="orange">#EA5C04</color>
<color name="dark_red">#A00809</color>
<color name="red_divider">#A91F20</color>
<color name="line_light_gray">#D9D9D9</color>
<color name="text_blue">#004A77</color>
<color name="text_white">#FFFFFF</color>
<color name="text_gray">#969696</color>
<color name="text_content_dark">#333</color>
<color name="text_dark_red">#980000</color>
<color name="tab_text_inactive">#98b6c8</color>
<color name="text_orange">#E74700</color>
<color name="text_black">#111111</color>
<color name="text_black_focused">#888888</color>
<color name="button_blue">#004A77</color>
<color name="button_blue_focused">#0075BA</color>
<color name="menu_list_divider">#9DD0F5</color>
<color name="menu_selected_item_background">#D6EDFF</color>
<color name="black_overlay">#66000000</color>
<color name="search_background">#A7D9FE</color>
<color name="splash_background">#A6D8FD</color>
<color name="darken_filter_color">#22000000</color>
<color name="classified_id_background">#DDDDDD</color>
<color name="red_button">#A00809</color>
<color name="red_button_focused">#f40809</color>
</resources>
The issue seems to be related to FullscreenTheme or FullscreenTheme.NoActionBar since I've been testing different approaches and have gotten different stack traces when changing these. However the code above was all running fine in SDK 21. I have a feeling a trained eye would see the issue instantly but I'm not a daily programmer regrettably.
It clearly says that it failed finding @string/error_maintenance.
Try to clean project
and to see if it has have the String resource named error_maintenance.
Plus, before, in my projects I was able to create a String resource with a dot like "error.maintenance" and calling it using @string/error_maintenance
.
Since api 28 I had to remove every dots in my strings.xml
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With