Skip to content

Commit

Permalink
Merge pull request #57 from hushenghao/master
Browse files Browse the repository at this point in the history
Support target Android U
  • Loading branch information
tiann authored Jun 20, 2023
2 parents cdf41d0 + db7be38 commit 2a839c3
Show file tree
Hide file tree
Showing 15 changed files with 52 additions and 72 deletions.
11 changes: 11 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

45 changes: 0 additions & 45 deletions .idea/jarRepositories.xml

This file was deleted.

2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 7 additions & 3 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 0 additions & 12 deletions .idea/runConfigurations.xml

This file was deleted.

8 changes: 4 additions & 4 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 28
compileSdkVersion 33
defaultConfig {
applicationId "me.weishu.freereflection.app"
minSdkVersion 21
targetSdkVersion 30
targetSdkVersion 'UpsideDownCake'
versionCode 1
versionName "1.0"

Expand All @@ -25,6 +25,6 @@ android {
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation project(":library")
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'androidx.appcompat:appcompat:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
}
4 changes: 3 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<activity
android:name=".MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

Expand Down
2 changes: 2 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@ org.gradle.jvmargs=-Xmx1536m
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
#android.enableJetifier=true
android.useAndroidX=true
Empty file modified gradlew
100755 → 100644
Empty file.
6 changes: 5 additions & 1 deletion library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,20 @@ android {
versionCode 1
versionName "1.0"

testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'

externalNativeBuild {
cmake {
cppFlags "-std=c++11"
arguments '-DANDROID_STL=c++_static'
}
}
// provider proguard-rules
consumerProguardFile 'proguard-rules.pro'
}

packageBuildConfig = false

buildTypes {
release {
minifyEnabled false
Expand Down
2 changes: 2 additions & 0 deletions library/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile

-keep class me.weishu.reflection.BootstrapClass { *; }
9 changes: 9 additions & 0 deletions library/src/main/java/me/weishu/reflection/Reflection.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,15 @@ private static boolean unsealByDexFile(Context context) {
fos.write(bytes);
}

// Support target Android U.
// https://developer.android.com/about/versions/14/behavior-changes-14#safer-dynamic-code-loading
try {
//noinspection ResultOfMethodCallIgnored
code.setReadOnly();
} catch (Throwable ignore) {
}

@SuppressWarnings("deprecation")
DexFile dexFile = new DexFile(code);
// This class is hardcoded in the dex, Don't use BootstrapClass.class to reference it
// it maybe obfuscated!!
Expand Down
3 changes: 0 additions & 3 deletions library/src/main/res/values/strings.xml

This file was deleted.

0 comments on commit 2a839c3

Please sign in to comment.