diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..1e2d8f1 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,11 @@ +# Default ignored files +/shelf/ +/inspectionProfiles +/libraries +/modules +androidTestResultsUserPreferences.xml +encodings.xml +jarRepositories.xml +workspace.xml +assetWizardSettings.xml +deploymentTargetDropDown.xml \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..61a9130 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml index ec2010d..66b5f52 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -1,9 +1,10 @@ + diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml deleted file mode 100644 index 376307e..0000000 --- a/.idea/jarRepositories.xml +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index 0d45e8d..58918f5 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,4 +1,4 @@ - + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml index cf1b6b5..a75ac0c 100644 --- a/.idea/modules.xml +++ b/.idea/modules.xml @@ -2,11 +2,15 @@ - + + + + - - + + + \ No newline at end of file diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml deleted file mode 100644 index 7f68460..0000000 --- a/.idea/runConfigurations.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index 1f4d086..fec67c3 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -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" @@ -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' } diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 0f4927e..56b01e3 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -9,7 +9,9 @@ android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/AppTheme"> - + diff --git a/gradle.properties b/gradle.properties index aac7c9b..c5a1121 100644 --- a/gradle.properties +++ b/gradle.properties @@ -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 diff --git a/gradlew b/gradlew old mode 100755 new mode 100644 diff --git a/library/build.gradle b/library/build.gradle index fdbb7ba..74328bd 100644 --- a/library/build.gradle +++ b/library/build.gradle @@ -8,7 +8,7 @@ android { versionCode 1 versionName "1.0" - testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner' externalNativeBuild { cmake { @@ -16,8 +16,12 @@ android { arguments '-DANDROID_STL=c++_static' } } + // provider proguard-rules + consumerProguardFile 'proguard-rules.pro' } + packageBuildConfig = false + buildTypes { release { minifyEnabled false diff --git a/library/proguard-rules.pro b/library/proguard-rules.pro index f1b4245..efb0c69 100644 --- a/library/proguard-rules.pro +++ b/library/proguard-rules.pro @@ -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 { *; } \ No newline at end of file diff --git a/library/src/main/java/me/weishu/reflection/Reflection.java b/library/src/main/java/me/weishu/reflection/Reflection.java index 9161812..f2b3305 100644 --- a/library/src/main/java/me/weishu/reflection/Reflection.java +++ b/library/src/main/java/me/weishu/reflection/Reflection.java @@ -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!! diff --git a/library/src/main/res/values/strings.xml b/library/src/main/res/values/strings.xml deleted file mode 100644 index e78d2f7..0000000 --- a/library/src/main/res/values/strings.xml +++ /dev/null @@ -1,3 +0,0 @@ - - Lib -