i want make use of "cold start" time showing branded launch theme, described in post. followed every step, when launching app, both emualtor , real device hot reboot. believe related google play services, use in app. tried run this project follows above post , doesn't include play services, , it's fine, it's not device-related. here's code:
manifest.xml
<application android:theme="@style/apptheme"> <activity android:name=".mainactivity" android:theme="@style/apptheme.launch"> <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" /> </intent-filter> </activity> </application>
styles.xml
<style name="apptheme.launch" parent="apptheme" > <item name="android:windowbackground">@drawable/bg_launch</item> </style>
bg_launch.xml
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" android:opacity="opaque"> <item android:drawable="?android:windowbackground" /> <item> <bitmap android:src="@drawable/ic_logo" android:gravity="center" /> </item>
build.gradle (plugin version: 2.0.0-alpha6)
apply plugin: 'com.android.application' android { compilesdkversion 23 buildtoolsversion '23.0.2' defaultconfig { applicationid "com.rocca.app" minsdkversion 16 targetsdkversion 23 versioncode 1 versionname "0.9" } buildtypes { release { minifyenabled true proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { compile filetree(dir: 'libs', include: ['*.jar']) testcompile 'junit:junit:4.12' compile 'com.android.support:appcompat-v7:23.1.1' compile 'com.android.support:gridlayout-v7:23.1.1' compile 'com.google.android.gms:play-services:8.4.0' compile 'com.android.support:support-v4:23.1.1' }
mainactivity.java
@override protected void oncreate(final bundle savedinstancestate) { settheme(r.style.apptheme); super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); setupgoogleapiclient(); //for iab setupads(); }
activity_main.xml
<relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:ads="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:animatelayoutchanges="true" android:id="@+id/root"> <com.google.android.gms.ads.adview android:id="@+id/ad_view" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_centerhorizontal="true" android:layout_alignparentbottom="true" ads:adsize="smart_banner" ads:adunitid="..." /> <android.support.v4.view.viewpager android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/viewpager" android:layout_above="@+id/ad_view"/> </relativelayout>
logcat:
e/androidruntime: fatal exception: main process: com.rocca.ringapp, pid: 5553 java.lang.runtimeexception: package manager has died @ android.app.applicationpackagemanager.hassystemfeature(applicationpackagemanager.java:413) @ org.chromium.android_webview.awsettings.<init>(awsettings.java:232) @ com.android.webview.chromium.webviewchromium.init(webviewchromium.java:232) @ android.webkit.webview.<init>(webview.java:606) @ android.webkit.webview.<init>(webview.java:542) @ android.webkit.webview.<init>(webview.java:525) @ android.webkit.webview.<init>(webview.java:512) @ android.webkit.webview.<init>(webview.java:502) @ com.google.android.gms.ads.internal.u.k.<init>(sourcefile:227) @ com.google.android.gms.ads.internal.u.k.a(sourcefile:204) @ com.google.android.gms.ads.internal.u.i.a(sourcefile:52) @ com.google.android.gms.ads.internal.d.a(sourcefile:76) @ com.google.android.gms.ads.internal.n.a(sourcefile:100) @ com.google.android.gms.ads.internal.g.run(sourcefile:196) @ android.os.handler.handlecallback(handler.java:739) @ android.os.handler.dispatchmessage(handler.java:95) @ android.os.looper.loop(looper.java:148) @ android.app.activitythread.main(activitythread.java:5417) @ java.lang.reflect.method.invoke(native method) @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:726) @ com.android.internal.os.zygoteinit.main(zygoteinit.java:616) caused by: android.os.deadobjectexception @ android.os.binderproxy.transactnative(native method) @ android.os.binderproxy.transact(binder.java:503) @ android.content.pm.ipackagemanager$stub$proxy.hassystemfeature(ipackagemanager.java:4264) @ android.app.applicationpackagemanager.hassystemfeature(applicationpackagemanager.java:411) @ org.chromium.android_webview.awsettings.<init>(awsettings.java:232) @ com.android.webview.chromium.webviewchromium.init(webviewchromium.java:232) @ android.webkit.webview.<init>(webview.java:606) @ android.webkit.webview.<init>(webview.java:542) @ android.webkit.webview.<init>(webview.java:525) @ android.webkit.webview.<init>(webview.java:512) @ android.webkit.webview.<init>(webview.java:502) @ com.google.android.gms.ads.internal.u.k.<init>(sourcefile:227) @ com.google.android.gms.ads.internal.u.k.a(sourcefile:204) @ com.google.android.gms.ads.internal.u.i.a(sourcefile:52) @ com.google.android.gms.ads.internal.d.a(sourcefile:76) @ com.google.android.gms.ads.internal.n.a(sourcefile:100) @ com.google.android.gms.ads.internal.g.run(sourcefile:196) @ android.os.handler.handlecallback(handler.java:739) @ android.os.handler.dispatchmessage(handler.java:95) @ android.os.looper.loop(looper.java:148) @ android.app.activitythread.main(activitythread.java:5417) @ java.lang.reflect.method.invoke(native method) @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:726) @ com.android.internal.os.zygoteinit.main(zygoteinit.java:616)
the error in bg_launch.xml, @ android:drawable="?android:windowbackground"
.
changing <item>
into
<item> <shape android:shape="rectangle"> <solid android:color="@color/grey_50" /> </shape> </item>
somehow makes work.
Comments
Post a Comment