Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Jun 5, 2024. It is now read-only.

Commit d40badc

Browse files
committed
更新补丁包下载地址
1 parent 75305c8 commit d40badc

File tree

3 files changed

+17
-6
lines changed

3 files changed

+17
-6
lines changed
Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2-
package="com.rae.cnblogs.sdk">
2+
package="com.rae.cnblogs.sdk">
33

4-
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
5-
<application android:label="@string/app_name">
6-
</application>
4+
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
5+
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
6+
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
7+
8+
<application android:label="@string/app_name"></application>
79

810
</manifest>

‎module-sdk/src/main/java/com/rae/cnblogs/sdk/CnblogsApiFactory.java‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,16 @@ private static CnblogsApiProvider createPatchProvider(Context context) {
8585
Log.e(TAG, "======== 热补丁文件不存在:" + filePath);
8686
return null;
8787
}
88-
String outputPath = context.getFilesDir().getAbsolutePath();
88+
if (!file.canRead()) {
89+
Log.e(TAG, "======== 补丁文件不可读:" + filePath);
90+
return null;
91+
}
92+
93+
String outputPath = context.getDir("code", Context.MODE_PRIVATE).getAbsolutePath();
94+
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
95+
outputPath = context.getCodeCacheDir().getAbsolutePath();
96+
}
97+
8998
Log.d(TAG, "======== 补丁文件:" + filePath);
9099
DexClassLoader dexClassLoader = new DexClassLoader(filePath, outputPath, outputPath, context.getClassLoader());
91100
Class<?> cls = dexClassLoader.loadClass("com.rae.cnblogs.sdk.PatchCnblogsApiProvider");

‎module-sdk/src/main/java/com/rae/cnblogs/sdk/DefaultCnblogsApiProvider.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public IRaeServerApi getRaeServerApi() {
9696

9797
@Override
9898
public String getDownloadUrl() {
99-
return "http://img.raeblog.com/cnblogs/patch/hotfix.patch";
99+
return "http://img.raeblog.com/cnblogs/patch/hotfix.dex";
100100
}
101101

102102
@NonNull

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /