Skip to content

Commit 3efa474

Browse files
author
ChenRui
committed
修复Android8.0闪退问题
1 parent 48db30d commit 3efa474

23 files changed

+2358
-2239
lines changed

app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ dependencies {
131131
compile 'com.jakewharton:butterknife:8.8.1'
132132
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
133133
compile 'in.srain.cube:ultra-ptr:1.0.11'
134-
compile 'com.github.raee:XRecyclerView:1.3.2'
134+
compile 'com.github.raee:XRecyclerView:1.3.3'
135135
compile 'com.makeramen:roundedimageview:2.3.0'
136136
compile 'com.github.bumptech.glide:glide:4.0.0'
137137
annotationProcessor 'com.github.bumptech.glide:compiler:4.0.0'
@@ -141,7 +141,7 @@ dependencies {
141141
compile 'com.github.chrisbanes:PhotoView:2.1.2'
142142
debugCompile 'com.squareup.leakcanary:leakcanary-android:1.5.1'
143143
releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.1'
144-
compile 'com.tencent.bugly:crashreport_upgrade:1.3.1'
144+
compile 'com.tencent.bugly:crashreport_upgrade:1.3.3'
145145
compile 'eu.davidea:flexible-adapter:5.0.0-rc2'
146146
// LeanCloud 基础包
147147
compile 'cn.leancloud.android:avoscloud-sdk:v4.4.3'

app/src/debug/res/AndroidManifest.xml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
xmlns:tools="http://schemas.android.com/tools"
4+
package="com.rae.cnblogs">
5+
6+
7+
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
8+
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
9+
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
10+
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
11+
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
12+
<uses-permission android:name="android.permission.MEDIA_CONTENT_CONTROL"/>
13+
<uses-permission android:name="android.permission.CAMERA"/>
14+
<uses-permission android:name="android.permission.INTERNET"/>
15+
<!--<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
16+
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
17+
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS"/>-->
18+
<uses-permission android:name="android.permission.READ_LOGS"/>
19+
20+
<application
21+
android:name=".CnblogsApplication"
22+
android:allowBackup="true"
23+
android:icon="@mipmap/ic_launcher"
24+
android:label="@string/app_name"
25+
android:supportsRtl="true"
26+
android:theme="@style/AppTheme">
27+
28+
<!--开始-快速开发需要移除下面的多进程-->
29+
<service
30+
android:name="com.squareup.leakcanary.internal.HeapAnalyzerService"
31+
android:enabled="false"
32+
tools:remove="process"/>
33+
<service
34+
android:name="com.tencent.tinker.lib.service.TinkerPatchService"
35+
android:exported="false"
36+
tools:remove="process"/>
37+
<service
38+
android:name="com.tencent.tinker.lib.service.TinkerPatchService$InnerService"
39+
android:exported="false"
40+
tools:remove="process"/>
41+
<!--结束-快速开发需要移除下面的多进程-->
42+
43+
</application>
44+
45+
</manifest>

app/src/debug/res/values/strings.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<resources>
3+
<string name="app_name">博客园开发版</string>
4+
</resources>

app/src/main/AndroidManifest.xml

Lines changed: 43 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -27,54 +27,54 @@
2727
<!--启动页-->
2828
<activity
2929
android:name=".activity.LauncherActivity"
30-
android:screenOrientation="portrait"
30+
3131
android:theme="@style/AppTheme.NoActionBar.FullScreen">
32-
<!-- <intent-filter>
33-
<action android:name="android.intent.action.MAIN"/>
32+
<!-- <intent-filter>
33+
<action android:name="android.intent.action.MAIN"/>
3434
35-
<category android:name="android.intent.category.LAUNCHER"/>
36-
</intent-filter>-->
35+
<category android:name="android.intent.category.LAUNCHER"/>
36+
</intent-filter>-->
3737
</activity>
3838

3939
<!--主界面-->
4040
<activity
4141
android:name=".activity.MainActivity"
42-
android:screenOrientation="portrait"
42+
4343
android:theme="@style/AppTheme.Dark">
44-
<intent-filter>
45-
<action android:name="android.intent.action.MAIN"/>
44+
<intent-filter>
45+
<action android:name="android.intent.action.MAIN"/>
4646

47-
<category android:name="android.intent.category.LAUNCHER"/>
48-
</intent-filter>
47+
<category android:name="android.intent.category.LAUNCHER"/>
48+
</intent-filter>
4949
</activity>
5050

5151
<activity
5252
android:name=".activity.TestActivity"
5353
android:label="博客园测试"
54-
android:screenOrientation="portrait"
54+
5555
android:theme="@style/AppTheme.Dark">
56-
<!-- <intent-filter>
57-
<action android:name="android.intent.action.MAIN"/>
58-
<category android:name="android.intent.category.LAUNCHER"/>
59-
</intent-filter>-->
56+
<!-- <intent-filter>
57+
<action android:name="android.intent.action.MAIN"/>
58+
<category android:name="android.intent.category.LAUNCHER"/>
59+
</intent-filter>-->
6060
</activity>
6161

6262
<!--博文-->
6363
<activity
6464
android:name=".activity.BlogContentActivity"
65-
android:screenOrientation="portrait"/>
65+
/>
6666

6767
<!--登录-->
6868
<activity
6969
android:name=".activity.LoginActivity"
7070
android:launchMode="singleTop"
71-
android:screenOrientation="portrait"/>
71+
/>
7272

7373

7474
<!--网页登录-->
7575
<activity
7676
android:name=".activity.WebLoginActivity"
77-
android:screenOrientation="portrait"/>
77+
/>
7878

7979
<!--网页-->
8080
<activity
@@ -88,81 +88,81 @@
8888
<!--博主-->
8989
<activity
9090
android:name=".activity.BloggerActivity"
91-
android:screenOrientation="portrait"/>
91+
/>
9292
<!--关注、粉丝-->
9393
<activity
9494
android:name=".activity.FriendsActivity"
95-
android:screenOrientation="portrait"/>
95+
/>
9696
<!--分类管理-->
9797
<activity
9898
android:name=".activity.CategoryActivity"
9999
android:label="@string/title_category"
100100
android:launchMode="singleTop"
101-
android:screenOrientation="portrait"/>
101+
/>
102102

103103
<activity
104104
android:name=".activity.FavoritesActivity"
105105
android:label="@string/my_favorites"
106106
android:launchMode="singleTop"
107-
android:screenOrientation="portrait"/>
107+
/>
108108

109109
<activity
110110
android:name=".activity.SettingActivity"
111111
android:label="@string/setting"
112112
android:launchMode="singleTop"
113-
android:screenOrientation="portrait"/>
113+
/>
114114

115115
<activity
116116
android:name=".activity.FeedbackActivity"
117117
android:label="@string/feedback"
118118
android:launchMode="singleTop"
119-
android:screenOrientation="portrait"
119+
120120
android:windowSoftInputMode="stateVisible"/>
121121

122122
<activity
123123
android:name=".activity.SearchActivity"
124-
android:screenOrientation="portrait"
124+
125125
android:windowSoftInputMode="stateVisible"/>
126126

127127
<activity
128128
android:name=".activity.SystemMessageActivity"
129129
android:label="@string/system_message"
130-
android:screenOrientation="portrait"/>
130+
/>
131131

132132
<activity
133133
android:name=".activity.FontSettingActivity"
134134
android:label="@string/font_setting"
135-
android:screenOrientation="portrait"/>
135+
/>
136136

137137
<activity
138138
android:name=".activity.CommentActivity"
139139
android:label="@string/label_comment"
140-
android:screenOrientation="portrait"/>
140+
/>
141141

142142
<activity
143143
android:name=".activity.PostMomentActivity"
144144
android:label="@string/label_post_moment"
145-
android:screenOrientation="portrait"/>
145+
/>
146146
<activity
147147
android:name=".activity.ImageSelectionActivity"
148148
android:label="@string/label_image_selection"
149-
android:screenOrientation="portrait">
149+
>
150150

151151
</activity>
152152
<activity
153153
android:name=".activity.MomentDetailActivity"
154154
android:label="@string/label_moment_detail"
155-
android:screenOrientation="portrait"/>
155+
/>
156156

157157
<activity
158158
android:name=".activity.MomentAtMeActivity"
159159
android:label="@string/label_moment_at_me"
160-
android:screenOrientation="portrait"/>
160+
/>
161161

162162
<activity
163163
android:name=".activity.MomentMessageActivity"
164164
android:label="@string/label_moment_message"
165-
android:screenOrientation="portrait"/>
165+
/>
166166

167167
<service
168168
android:name=".service.CnblogsService"
@@ -197,7 +197,7 @@
197197
android:name=".wxapi.WXEntryActivity"
198198
android:configChanges="keyboardHidden|orientation|screenSize"
199199
android:exported="true"
200-
android:screenOrientation="portrait"
200+
201201
android:theme="@android:style/Theme.Translucent.NoTitleBar"/>
202202

203203

@@ -206,14 +206,14 @@
206206
android:name=".activity.WBShareActivity"
207207
android:configChanges="keyboardHidden|orientation"
208208
android:launchMode="singleTask"
209-
android:screenOrientation="portrait"/>
209+
/>
210210

211211
<!--新浪微博-->
212212
<activity
213213
android:name="com.umeng.socialize.media.WBShareCallBackActivity"
214214
android:configChanges="keyboardHidden|orientation"
215215
android:exported="false"
216-
android:screenOrientation="portrait"
216+
217217
android:theme="@android:style/Theme.Translucent.NoTitleBar">
218218
</activity>
219219

@@ -229,6 +229,7 @@
229229

230230
</activity>
231231

232+
<!--文件提供者-->
232233
<provider
233234
android:name="android.support.v4.content.FileProvider"
234235
android:authorities="com.rae.cnblogs.fileprovider"
@@ -239,6 +240,12 @@
239240
android:resource="@xml/lc_fileprovider_path"/>
240241
</provider>
241242

243+
<!--数据库提供者,解决Android 8.0 权限问题-->
244+
<provider
245+
android:name="com.rae.cnblogs.sdk.db.CnblogsContentProvider"
246+
android:authorities="com.rae.cnblogs"
247+
android:enabled="true"
248+
android:exported="false"/>
242249

243250
<meta-data
244251
android:name="UMENG_APPKEY"

app/src/main/java/com/rae/cnblogs/CnblogsApplication.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import com.avos.avoscloud.feedback.FeedbackThread;
1010
import com.rae.cnblogs.sdk.UserProvider;
1111
import com.rae.cnblogs.sdk.bean.UserInfoBean;
12-
import com.rae.cnblogs.sdk.db.DbCnblogs;
1312
import com.rae.cnblogs.sdk.db.DbFactory;
1413
import com.rae.swift.session.SessionManager;
1514
import com.tencent.bugly.Bugly;
@@ -37,25 +36,25 @@ public void onCreate() {
3736
super.onCreate();
3837

3938
// 级别较高的初始化操作
40-
DbCnblogs.init(getApplication());
4139
if (!BuildConfig.DEBUG) {
4240
// 正式环境
4341
Bugly.init(getApplication(), BuildConfig.BUGLY_APP_ID, false);
44-
MobclickAgent.setCatchUncaughtExceptions(true);
4542
} else {
4643
// 开发环境
47-
MobclickAgent.setCatchUncaughtExceptions(false);
4844
}
4945

5046
// if (!LeakCanary.isInAnalyzerProcess(this)) {
5147
// LeakCanary.install(this);
5248
// }
5349

50+
DbFactory.init(this);
5451

55-
// LeanCloud用户反馈初始化,要在主线程总
52+
// LeanCloud用户反馈初始化,要在主线程
5653
AVOSCloud.initialize(getApplication(), BuildConfig.LEAN_CLOUD_APP_ID, BuildConfig.LEAN_CLOUD_APP_KEY);
5754
FeedbackThread.getInstance();
5855

56+
MobclickAgent.setCatchUncaughtExceptions(BuildConfig.DEBUG);
57+
5958
// 加载皮肤
6059
SkinCompatManager.withoutActivity(getApplication()).loadSkin();
6160
SkinCompatManager.getInstance()

0 commit comments

Comments
 (0)