├── .gitignore
├── 1-Classloader
├── .gitignore
├── README.md
├── app
│ ├── .gitignore
│ ├── build.gradle
│ ├── proguard-rules.pro
│ └── src
│ │ ├── androidTest
│ │ └── java
│ │ │ └── com
│ │ │ └── example
│ │ │ └── classloader
│ │ │ └── ExampleInstrumentedTest.java
│ │ ├── main
│ │ ├── AndroidManifest.xml
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── example
│ │ │ │ └── classloader
│ │ │ │ └── MainActivity.java
│ │ └── res
│ │ │ ├── layout
│ │ │ └── activity_main.xml
│ │ │ ├── mipmap-hdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-mdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xhdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xxxhdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── values-w820dp
│ │ │ └── dimens.xml
│ │ │ └── values
│ │ │ ├── colors.xml
│ │ │ ├── dimens.xml
│ │ │ ├── strings.xml
│ │ │ └── styles.xml
│ │ └── test
│ │ └── java
│ │ └── com
│ │ └── example
│ │ └── classloader
│ │ └── ExampleUnitTest.java
├── build.gradle
├── gradle.properties
├── gradle
│ └── wrapper
│ │ ├── gradle-wrapper.jar
│ │ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
└── settings.gradle
├── 2-LoadPluginClass
├── README.md
├── host
│ ├── .gitignore
│ ├── app
│ │ ├── .gitignore
│ │ ├── build.gradle
│ │ ├── proguard-rules.pro
│ │ └── src
│ │ │ ├── androidTest
│ │ │ └── java
│ │ │ │ └── com
│ │ │ │ └── example
│ │ │ │ └── loadpluginclass
│ │ │ │ └── ExampleInstrumentedTest.java
│ │ │ ├── main
│ │ │ ├── AndroidManifest.xml
│ │ │ ├── java
│ │ │ │ └── com
│ │ │ │ │ └── example
│ │ │ │ │ └── loadpluginclass
│ │ │ │ │ ├── LoadPluginClassTestInterface.java
│ │ │ │ │ └── MainActivity.java
│ │ │ └── res
│ │ │ │ ├── layout
│ │ │ │ └── activity_main.xml
│ │ │ │ ├── mipmap-hdpi
│ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-mdpi
│ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-xhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-xxhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-xxxhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ │ ├── values-w820dp
│ │ │ │ └── dimens.xml
│ │ │ │ └── values
│ │ │ │ ├── colors.xml
│ │ │ │ ├── dimens.xml
│ │ │ │ ├── strings.xml
│ │ │ │ └── styles.xml
│ │ │ └── test
│ │ │ └── java
│ │ │ └── com
│ │ │ └── example
│ │ │ └── loadpluginclass
│ │ │ └── ExampleUnitTest.java
│ ├── build.gradle
│ ├── gradle.properties
│ ├── gradle
│ │ └── wrapper
│ │ │ ├── gradle-wrapper.jar
│ │ │ └── gradle-wrapper.properties
│ ├── gradlew
│ ├── gradlew.bat
│ └── settings.gradle
├── plugin
│ ├── origin.jar
│ └── src
│ │ └── com
│ │ └── example
│ │ └── loadpluginclass
│ │ ├── LoadPluginClassTestInterface.java
│ │ └── PluginClassWillBeLoad.java
└── pluginByApk
│ ├── .gitignore
│ ├── app
│ ├── .gitignore
│ ├── build.gradle
│ ├── proguard-rules.pro
│ └── src
│ │ ├── androidTest
│ │ └── java
│ │ │ └── com
│ │ │ └── example
│ │ │ └── loadpluginclass
│ │ │ └── ExampleInstrumentedTest.java
│ │ ├── main
│ │ ├── AndroidManifest.xml
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── example
│ │ │ │ └── loadpluginclass
│ │ │ │ ├── LoadPluginClassTestInterface.java
│ │ │ │ ├── MainActivity.java
│ │ │ │ └── PluginClassWillBeLoad.java
│ │ └── res
│ │ │ ├── layout
│ │ │ └── activity_main.xml
│ │ │ ├── mipmap-hdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-mdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xhdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xxxhdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── values-w820dp
│ │ │ └── dimens.xml
│ │ │ └── values
│ │ │ ├── colors.xml
│ │ │ ├── dimens.xml
│ │ │ ├── strings.xml
│ │ │ └── styles.xml
│ │ └── test
│ │ └── java
│ │ └── com
│ │ └── example
│ │ └── loadpluginclass
│ │ └── ExampleUnitTest.java
│ ├── build.gradle
│ ├── gradle.properties
│ ├── gradle
│ └── wrapper
│ │ ├── gradle-wrapper.jar
│ │ └── gradle-wrapper.properties
│ ├── gradlew
│ ├── gradlew.bat
│ └── settings.gradle
├── 3-StartPluginActivity
├── README.md
├── host
│ ├── .gitignore
│ ├── app
│ │ ├── .gitignore
│ │ ├── build.gradle
│ │ ├── proguard-rules.pro
│ │ └── src
│ │ │ ├── androidTest
│ │ │ └── java
│ │ │ │ └── com
│ │ │ │ └── example
│ │ │ │ └── startpluginactivity
│ │ │ │ └── ExampleInstrumentedTest.java
│ │ │ ├── main
│ │ │ ├── AndroidManifest.xml
│ │ │ ├── java
│ │ │ │ └── com
│ │ │ │ │ └── example
│ │ │ │ │ └── startpluginactivity
│ │ │ │ │ ├── CustomInstrumentation.java
│ │ │ │ │ ├── MainActivity.java
│ │ │ │ │ └── MyApplication.java
│ │ │ └── res
│ │ │ │ ├── layout
│ │ │ │ └── activity_main.xml
│ │ │ │ ├── mipmap-hdpi
│ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-mdpi
│ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-xhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-xxhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-xxxhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ │ ├── values-w820dp
│ │ │ │ └── dimens.xml
│ │ │ │ └── values
│ │ │ │ ├── colors.xml
│ │ │ │ ├── dimens.xml
│ │ │ │ ├── strings.xml
│ │ │ │ └── styles.xml
│ │ │ └── test
│ │ │ └── java
│ │ │ └── com
│ │ │ └── example
│ │ │ └── startpluginactivity
│ │ │ └── ExampleUnitTest.java
│ ├── build.gradle
│ ├── gradle.properties
│ ├── gradle
│ │ └── wrapper
│ │ │ ├── gradle-wrapper.jar
│ │ │ └── gradle-wrapper.properties
│ ├── gradlew
│ ├── gradlew.bat
│ └── settings.gradle
└── plugin
│ ├── .gitignore
│ ├── app
│ ├── .gitignore
│ ├── build.gradle
│ ├── proguard-rules.pro
│ └── src
│ │ ├── androidTest
│ │ └── java
│ │ │ └── com
│ │ │ └── example
│ │ │ └── plugin3
│ │ │ └── ExampleInstrumentedTest.java
│ │ ├── main
│ │ ├── AndroidManifest.xml
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── example
│ │ │ │ └── plugin3
│ │ │ │ └── MainActivity.java
│ │ └── res
│ │ │ ├── layout
│ │ │ └── activity_main.xml
│ │ │ ├── mipmap-hdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-mdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xhdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xxxhdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── values-w820dp
│ │ │ └── dimens.xml
│ │ │ └── values
│ │ │ ├── colors.xml
│ │ │ ├── dimens.xml
│ │ │ ├── strings.xml
│ │ │ └── styles.xml
│ │ └── test
│ │ └── java
│ │ └── com
│ │ └── example
│ │ └── plugin3
│ │ └── ExampleUnitTest.java
│ ├── build.gradle
│ ├── gradle.properties
│ ├── gradle
│ └── wrapper
│ │ ├── gradle-wrapper.jar
│ │ └── gradle-wrapper.properties
│ ├── gradlew
│ ├── gradlew.bat
│ └── settings.gradle
├── 4-LoadPluginResource
├── README.md
├── host
│ ├── .gitignore
│ ├── app
│ │ ├── .gitignore
│ │ ├── build.gradle
│ │ ├── proguard-rules.pro
│ │ └── src
│ │ │ └── main
│ │ │ ├── AndroidManifest.xml
│ │ │ ├── java
│ │ │ └── com
│ │ │ │ └── example
│ │ │ │ └── loadpluginresource
│ │ │ │ ├── CustomInstrumentation.java
│ │ │ │ ├── MainActivity.java
│ │ │ │ └── MyApplication.java
│ │ │ └── res
│ │ │ ├── layout
│ │ │ └── activity_main.xml
│ │ │ ├── mipmap-hdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-mdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xhdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xxxhdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── values-w820dp
│ │ │ └── dimens.xml
│ │ │ └── values
│ │ │ ├── colors.xml
│ │ │ ├── dimens.xml
│ │ │ ├── strings.xml
│ │ │ └── styles.xml
│ ├── build.gradle
│ ├── gradle.properties
│ ├── gradle
│ │ └── wrapper
│ │ │ ├── gradle-wrapper.jar
│ │ │ └── gradle-wrapper.properties
│ ├── gradlew
│ ├── gradlew.bat
│ └── settings.gradle
└── plugin
│ ├── .gitignore
│ ├── app
│ ├── .gitignore
│ ├── build.gradle
│ ├── proguard-rules.pro
│ └── src
│ │ ├── androidTest
│ │ └── java
│ │ │ └── com
│ │ │ └── example
│ │ │ └── plugin4
│ │ │ └── ExampleInstrumentedTest.java
│ │ ├── main
│ │ ├── AndroidManifest.xml
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── example
│ │ │ │ └── plugin4
│ │ │ │ └── MainActivity.java
│ │ └── res
│ │ │ ├── layout
│ │ │ └── activity_main.xml
│ │ │ ├── mipmap-hdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-mdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xhdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xxxhdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── values-w820dp
│ │ │ └── dimens.xml
│ │ │ └── values
│ │ │ ├── colors.xml
│ │ │ ├── dimens.xml
│ │ │ ├── strings.xml
│ │ │ └── styles.xml
│ │ └── test
│ │ └── java
│ │ └── com
│ │ └── example
│ │ └── plugin4
│ │ └── ExampleUnitTest.java
│ ├── build.gradle
│ ├── gradle.properties
│ ├── gradle
│ └── wrapper
│ │ ├── gradle-wrapper.jar
│ │ └── gradle-wrapper.properties
│ ├── gradlew
│ ├── gradlew.bat
│ └── settings.gradle
├── 5-ResModificationPlugin
├── README.md
├── host
│ ├── .gitignore
│ ├── app
│ │ ├── .gitignore
│ │ ├── build.gradle
│ │ ├── proguard-rules.pro
│ │ └── src
│ │ │ ├── androidTest
│ │ │ └── java
│ │ │ │ └── com
│ │ │ │ └── example
│ │ │ │ └── resmodification
│ │ │ │ └── ExampleInstrumentedTest.java
│ │ │ ├── main
│ │ │ ├── AndroidManifest.xml
│ │ │ ├── java
│ │ │ │ └── com
│ │ │ │ │ └── example
│ │ │ │ │ └── resmodification
│ │ │ │ │ ├── CustomInstrumentation.java
│ │ │ │ │ ├── MainActivity.java
│ │ │ │ │ └── MyApplication.java
│ │ │ └── res
│ │ │ │ ├── layout
│ │ │ │ └── activity_main.xml
│ │ │ │ ├── mipmap-hdpi
│ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-mdpi
│ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-xhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-xxhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-xxxhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ │ ├── values-w820dp
│ │ │ │ └── dimens.xml
│ │ │ │ └── values
│ │ │ │ ├── colors.xml
│ │ │ │ ├── dimens.xml
│ │ │ │ ├── strings.xml
│ │ │ │ └── styles.xml
│ │ │ └── test
│ │ │ └── java
│ │ │ └── com
│ │ │ └── example
│ │ │ └── resmodification
│ │ │ └── ExampleUnitTest.java
│ ├── build.gradle
│ ├── gradle.properties
│ ├── gradle
│ │ └── wrapper
│ │ │ ├── gradle-wrapper.jar
│ │ │ └── gradle-wrapper.properties
│ ├── gradlew
│ ├── gradlew.bat
│ └── settings.gradle
├── plugin
│ ├── .gitignore
│ ├── app
│ │ ├── .gitignore
│ │ ├── build.gradle
│ │ ├── proguard-rules.pro
│ │ └── src
│ │ │ ├── androidTest
│ │ │ └── java
│ │ │ │ └── com
│ │ │ │ └── example
│ │ │ │ └── plugin5
│ │ │ │ └── ExampleInstrumentedTest.java
│ │ │ ├── main
│ │ │ ├── AndroidManifest.xml
│ │ │ ├── java
│ │ │ │ └── com
│ │ │ │ │ └── example
│ │ │ │ │ └── plugin5
│ │ │ │ │ └── MainActivity.java
│ │ │ └── res
│ │ │ │ ├── layout
│ │ │ │ └── plugin_activity_main.xml
│ │ │ │ ├── mipmap-hdpi
│ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-mdpi
│ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-xhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-xxhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-xxxhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ │ ├── values-w820dp
│ │ │ │ └── dimens.xml
│ │ │ │ └── values
│ │ │ │ ├── colors.xml
│ │ │ │ ├── dimens.xml
│ │ │ │ ├── strings.xml
│ │ │ │ └── styles.xml
│ │ │ └── test
│ │ │ └── java
│ │ │ └── com
│ │ │ └── example
│ │ │ └── plugin5
│ │ │ └── ExampleUnitTest.java
│ ├── build.gradle
│ ├── gradle.properties
│ ├── gradle
│ │ └── wrapper
│ │ │ ├── gradle-wrapper.jar
│ │ │ └── gradle-wrapper.properties
│ ├── gradlew
│ ├── gradlew.bat
│ └── settings.gradle
└── res-modification-plugin
│ ├── .gitignore
│ ├── README.md
│ ├── build.gradle
│ ├── gradle
│ └── wrapper
│ │ ├── gradle-wrapper.jar
│ │ └── gradle-wrapper.properties
│ ├── gradlew
│ ├── gradlew.bat
│ ├── settings.gradle
│ └── src
│ └── main
│ ├── groovy
│ └── com
│ │ └── example
│ │ └── gradle
│ │ ├── PluginImpl.groovy
│ │ ├── ZipUtils.groovy
│ │ └── aapt
│ │ ├── AXmlEditor.groovy
│ │ ├── Aapt.groovy
│ │ ├── ArscEditor.groovy
│ │ ├── AssetEditor.groovy
│ │ ├── CppHexEditor.groovy
│ │ ├── ResAttr.groovy
│ │ ├── ResStringFlag.groovy
│ │ ├── ResStringPoolSpan.groovy
│ │ ├── ResTableEntry.groovy
│ │ ├── ResTableType.groovy
│ │ ├── ResType.groovy
│ │ ├── ResValueDataType.groovy
│ │ └── SymbolParser.groovy
│ └── resources
│ └── META-INF
│ └── gradle-plugins
│ └── res-modification.properties
├── 6-StartPluginService
├── README.md
├── host
│ ├── .gitignore
│ ├── app
│ │ ├── .gitignore
│ │ ├── build.gradle
│ │ ├── proguard-rules.pro
│ │ └── src
│ │ │ ├── androidTest
│ │ │ └── java
│ │ │ │ └── com
│ │ │ │ └── example
│ │ │ │ └── startserviceplugin
│ │ │ │ └── ExampleInstrumentedTest.java
│ │ │ ├── main
│ │ │ ├── AndroidManifest.xml
│ │ │ ├── java
│ │ │ │ └── com
│ │ │ │ │ └── example
│ │ │ │ │ └── startserviceplugin
│ │ │ │ │ ├── MainActivity.java
│ │ │ │ │ └── MyApplication.java
│ │ │ └── res
│ │ │ │ ├── layout
│ │ │ │ └── activity_main.xml
│ │ │ │ ├── mipmap-hdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ │ ├── mipmap-mdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ │ ├── mipmap-xhdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ │ ├── mipmap-xxhdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ │ ├── mipmap-xxxhdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ │ └── values
│ │ │ │ ├── colors.xml
│ │ │ │ ├── strings.xml
│ │ │ │ └── styles.xml
│ │ │ └── test
│ │ │ └── java
│ │ │ └── com
│ │ │ └── example
│ │ │ └── startserviceplugin
│ │ │ └── ExampleUnitTest.java
│ ├── build.gradle
│ ├── gradle.properties
│ ├── gradle
│ │ └── wrapper
│ │ │ ├── gradle-wrapper.jar
│ │ │ └── gradle-wrapper.properties
│ ├── gradlew
│ ├── gradlew.bat
│ └── settings.gradle
└── plugin
│ ├── .gitignore
│ ├── app
│ ├── .gitignore
│ ├── build.gradle
│ ├── proguard-rules.pro
│ └── src
│ │ ├── androidTest
│ │ └── java
│ │ │ └── com
│ │ │ └── example
│ │ │ └── plugin6
│ │ │ └── ExampleInstrumentedTest.java
│ │ ├── main
│ │ ├── AndroidManifest.xml
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── example
│ │ │ │ └── plugin6
│ │ │ │ ├── PluginActivity.java
│ │ │ │ └── PluginService.java
│ │ └── res
│ │ │ ├── layout
│ │ │ └── activity_plugin.xml
│ │ │ ├── mipmap-hdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-mdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xhdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xxxhdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ │ └── values
│ │ │ ├── colors.xml
│ │ │ ├── strings.xml
│ │ │ └── styles.xml
│ │ └── test
│ │ └── java
│ │ └── com
│ │ └── example
│ │ └── plugin6
│ │ └── ExampleUnitTest.java
│ ├── build.gradle
│ ├── gradle.properties
│ ├── gradle
│ └── wrapper
│ │ ├── gradle-wrapper.jar
│ │ └── gradle-wrapper.properties
│ ├── gradlew
│ ├── gradlew.bat
│ └── settings.gradle
├── 7-MultiClassloader
├── README.md
├── host
│ ├── .gitignore
│ ├── app
│ │ ├── .gitignore
│ │ ├── build.gradle
│ │ ├── proguard-rules.pro
│ │ └── src
│ │ │ └── main
│ │ │ ├── AndroidManifest.xml
│ │ │ ├── java
│ │ │ └── com
│ │ │ │ └── example
│ │ │ │ └── multiclassloader
│ │ │ │ ├── BundleClassloader.java
│ │ │ │ ├── DispatchClassloader.java
│ │ │ │ ├── LoadPluginClassTestInterface.java
│ │ │ │ ├── MainActivity.java
│ │ │ │ └── MultiClassloaderApplication.java
│ │ │ └── res
│ │ │ ├── layout
│ │ │ └── activity_main.xml
│ │ │ ├── mipmap-hdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-mdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xhdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xxxhdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── values-w820dp
│ │ │ └── dimens.xml
│ │ │ └── values
│ │ │ ├── colors.xml
│ │ │ ├── dimens.xml
│ │ │ ├── strings.xml
│ │ │ └── styles.xml
│ ├── build.gradle
│ ├── gradle.properties
│ ├── gradle
│ │ └── wrapper
│ │ │ ├── gradle-wrapper.jar
│ │ │ └── gradle-wrapper.properties
│ ├── gradlew
│ ├── gradlew.bat
│ └── settings.gradle
└── plugin
│ └── src
│ ├── com
│ └── example
│ │ └── multiclassloader
│ │ ├── LoadPluginClassTestInterface.java
│ │ └── PluginClassWillBeLoad.java
│ └── origin.jar
├── 8-PackagePluginJavaCode
├── README.md
├── host
│ ├── .gitignore
│ ├── app
│ │ ├── .gitignore
│ │ ├── build.gradle
│ │ ├── proguard-rules.pro
│ │ └── src
│ │ │ └── main
│ │ │ ├── AndroidManifest.xml
│ │ │ ├── java
│ │ │ └── com
│ │ │ │ └── example
│ │ │ │ └── multiclassloader
│ │ │ │ ├── BundleClassloader.java
│ │ │ │ ├── DispatchClassloader.java
│ │ │ │ ├── LoadPluginClassTestInterface.java
│ │ │ │ ├── MainActivity.java
│ │ │ │ └── MultiClassloaderApplication.java
│ │ │ └── res
│ │ │ ├── layout
│ │ │ └── activity_main.xml
│ │ │ ├── mipmap-hdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-mdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xhdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xxxhdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── values-w820dp
│ │ │ └── dimens.xml
│ │ │ └── values
│ │ │ ├── colors.xml
│ │ │ ├── dimens.xml
│ │ │ ├── strings.xml
│ │ │ └── styles.xml
│ ├── build.gradle
│ ├── gradle.properties
│ ├── gradle
│ │ └── wrapper
│ │ │ ├── gradle-wrapper.jar
│ │ │ └── gradle-wrapper.properties
│ ├── gradlew
│ ├── gradlew.bat
│ └── settings.gradle
└── pluginByApk
│ ├── .gitignore
│ ├── app
│ ├── .gitignore
│ ├── build.gradle
│ ├── proguard-rules.pro
│ └── src
│ │ └── main
│ │ ├── AndroidManifest.xml
│ │ ├── java
│ │ └── com
│ │ │ └── example
│ │ │ └── multiclassloader
│ │ │ ├── LoadPluginClassTestInterface.java
│ │ │ ├── PluginActivity.java
│ │ │ └── PluginClassWillBeLoad.java
│ │ └── res
│ │ ├── layout
│ │ └── activity_main.xml
│ │ ├── mipmap-hdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-mdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-xhdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-xxhdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-xxxhdpi
│ │ └── ic_launcher.png
│ │ ├── values-w820dp
│ │ └── dimens.xml
│ │ └── values
│ │ ├── colors.xml
│ │ ├── dimens.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ ├── build.gradle
│ ├── gradle.properties
│ ├── gradle
│ └── wrapper
│ │ ├── gradle-wrapper.jar
│ │ └── gradle-wrapper.properties
│ ├── gradlew
│ ├── gradlew.bat
│ └── settings.gradle
├── LICENSE
└── README.md
/.gitignore:
--------------------------------------------------------------------------------
1 | # Built application files
2 | *.apk
3 | *.ap_
4 |
5 | # Files for the ART/Dalvik VM
6 | *.dex
7 |
8 | # Java class files
9 | *.class
10 |
11 | # Generated files
12 | bin/
13 | gen/
14 | out/
15 |
16 | # Gradle files
17 | .gradle/
18 | build/
19 |
20 | # Local configuration file (sdk path, etc)
21 | local.properties
22 |
23 | # Proguard folder generated by Eclipse
24 | proguard/
25 |
26 | # Log Files
27 | *.log
28 |
29 | # Android Studio Navigation editor temp files
30 | .navigation/
31 |
32 | # Android Studio captures folder
33 | captures/
34 |
35 | # Intellij
36 | *.iml
37 | .idea/workspace.xml
38 |
39 | # Keystore files
40 | *.jks
41 |
--------------------------------------------------------------------------------
/1-Classloader/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/
5 | .DS_Store
6 | /build
7 | /captures
8 | .externalNativeBuild
9 |
--------------------------------------------------------------------------------
/1-Classloader/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/1-Classloader/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 24
5 | buildToolsVersion "24.0.3"
6 | defaultConfig {
7 | applicationId "com.example.classloader"
8 | minSdkVersion 21
9 | targetSdkVersion 24
10 | versionCode 1
11 | versionName "1.0"
12 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
13 | }
14 | buildTypes {
15 | release {
16 | minifyEnabled false
17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18 | }
19 | }
20 | }
21 |
22 | dependencies {
23 | compile fileTree(dir: 'libs', include: ['*.jar'])
24 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
25 | exclude group: 'com.android.support', module: 'support-annotations'
26 | })
27 | compile 'com.android.support:appcompat-v7:24.2.1'
28 | testCompile 'junit:junit:4.12'
29 | }
30 |
--------------------------------------------------------------------------------
/1-Classloader/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /Users/2bab/Dependence/sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/1-Classloader/app/src/androidTest/java/com/example/classloader/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.example.classloader;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumentation test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() throws Exception {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("com.example.classloader", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/1-Classloader/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/1-Classloader/app/src/main/java/com/example/classloader/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.example.classloader;
2 |
3 | import android.os.Bundle;
4 | import android.support.v7.app.AppCompatActivity;
5 | import android.util.Log;
6 |
7 | public class MainActivity extends AppCompatActivity {
8 |
9 | @Override
10 | protected void onCreate(Bundle savedInstanceState) {
11 | super.onCreate(savedInstanceState);
12 | setContentView(R.layout.activity_main);
13 | countClassLoader();
14 | }
15 |
16 | private void countClassLoader() {
17 | ClassLoader classLoader = getClassLoader();
18 | if (classLoader != null) {
19 | Log.i("[CountClassLoader]", classLoader.toString());
20 | while (classLoader.getParent() != null) {
21 | classLoader = classLoader.getParent();
22 | Log.i("[CountClassLoader]", classLoader.toString());
23 | }
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/1-Classloader/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
12 |
13 |
17 |
18 |
--------------------------------------------------------------------------------
/1-Classloader/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2BAB/Android-Dynamic-Loading-Notes/dc6cd3e7aae2c9b5332ce743f247ef194b35f90f/1-Classloader/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/1-Classloader/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2BAB/Android-Dynamic-Loading-Notes/dc6cd3e7aae2c9b5332ce743f247ef194b35f90f/1-Classloader/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/1-Classloader/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2BAB/Android-Dynamic-Loading-Notes/dc6cd3e7aae2c9b5332ce743f247ef194b35f90f/1-Classloader/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/1-Classloader/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2BAB/Android-Dynamic-Loading-Notes/dc6cd3e7aae2c9b5332ce743f247ef194b35f90f/1-Classloader/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/1-Classloader/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2BAB/Android-Dynamic-Loading-Notes/dc6cd3e7aae2c9b5332ce743f247ef194b35f90f/1-Classloader/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/1-Classloader/app/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/1-Classloader/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/1-Classloader/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 |
6 |
--------------------------------------------------------------------------------
/1-Classloader/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Classloader
3 |
4 |
--------------------------------------------------------------------------------
/1-Classloader/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/1-Classloader/app/src/test/java/com/example/classloader/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.example.classloader;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() throws Exception {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/1-Classloader/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | repositories {
5 | jcenter()
6 | }
7 | dependencies {
8 | classpath 'com.android.tools.build:gradle:2.2.2'
9 |
10 | // NOTE: Do not place your application dependencies here; they belong
11 | // in the individual module build.gradle files
12 | }
13 | }
14 |
15 | allprojects {
16 | repositories {
17 | jcenter()
18 | }
19 | }
20 |
21 | task clean(type: Delete) {
22 | delete rootProject.buildDir
23 | }
24 |
--------------------------------------------------------------------------------
/1-Classloader/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | org.gradle.jvmargs=-Xmx1536m
13 |
14 | # When configured, Gradle will run in incubating parallel mode.
15 | # This option should only be used with decoupled projects. More details, visit
16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
17 | # org.gradle.parallel=true
18 |
--------------------------------------------------------------------------------
/1-Classloader/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2BAB/Android-Dynamic-Loading-Notes/dc6cd3e7aae2c9b5332ce743f247ef194b35f90f/1-Classloader/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/1-Classloader/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Mon Dec 28 10:00:20 PST 2015
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
7 |
--------------------------------------------------------------------------------
/1-Classloader/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------
/2-LoadPluginClass/README.md:
--------------------------------------------------------------------------------
1 | # Android插件化笔记-2-LoadPluginClass
2 |
3 |
4 | ## 如何获取能够被加载的 .dex 文件
5 |
6 | 准备如下两个测试类,其中TestDexInterface还需要拷贝一份到工程中
7 |
8 | **TestDexClass.java**
9 |
10 | ```java
11 | package example.com.classeasyload;
12 |
13 | public class TestDexClass implements TestDexInterface{
14 |
15 | @Override
16 | public float getPiValue() {
17 | return 3.14f;
18 | }
19 |
20 | }
21 | ```
22 |
23 | **TestDexInterface.java**
24 |
25 | ```java
26 | package example.com.classeasyload;
27 |
28 | public interface TestDexInterface {
29 |
30 | float getPiValue();
31 |
32 | }
33 | ```
34 |
35 |
36 |
37 | 1. `javac *.java -> .class`
38 | 2. `jar cvf origin.jar . -> .jar`
39 | 3. `dx --dex --output=target.dex origin.jar -> .dex`
40 |
41 |
42 |
43 | 按文章的步骤,自己实现了一遍,需要注意的是第二步打jar包的时候需要连包名所在的文件夹一起打进去
44 |
45 | ```
46 | |____example
47 | | |____com
48 | | | |____classeasyload
49 | | | | |____TestDexClass.class
50 | | | | |____TestDexInterface.class
51 | ```
52 |
53 | jar包里应该是如上的结构。
54 |
55 | ## 加载并调用.dex里面的方法
56 |
57 | 这里我先 `adb shell mkdir -p /system/dex/`, 然后`adb push target.dex /system/dex/`
58 | 如MainActivity里代码所示:
59 |
60 | ```java
61 | File optimizedDexOutputPath = new File("/system/dex/" + "target.dex");// 外部路径
62 | File dexOutputDir = this.getDir("dex", 0);// 无法直接从外部路径加载.dex文件,需要指定APP内部路径作为缓存目录(.dex文件会被解压到此目录)
63 | DexClassLoader dexClassLoader = new DexClassLoader(
64 | optimizedDexOutputPath.getAbsolutePath(),
65 | dexOutputDir.getAbsolutePath(),
66 | null,
67 | getClassLoader());
68 | try {
69 | Class libProviderClazz = dexClassLoader.loadClass("example.com.classeasyload.TestDexClass");
70 | TestDexInterface dexInterface = (TestDexInterface) libProviderClazz.newInstance();
71 | Toast.makeText(this, dexInterface.getPiValue() + "", Toast.LENGTH_LONG).show();
72 | } catch (Exception e) {
73 | e.printStackTrace();
74 | }
75 | ```
76 |
77 | 最终成功Toast出了`3.14`。
78 |
79 |
80 | ## 参考资料:
81 |
82 | 本系列为笔记文,文中有大量的源码解析都是引用的其他作者的成果,详见下方参考资料。
83 |
84 | - [http://blog.csdn.net/singwhatiwanna/article/details/40283117](http://blog.csdn.net/singwhatiwanna/article/details/40283117)
85 | - [http://blog.csdn.net/NUPTboyZHB/article/category/1204147](http://blog.csdn.net/NUPTboyZHB/article/category/1204147)
86 | - [https://zhuanlan.zhihu.com/p/20515113](https://zhuanlan.zhihu.com/p/20515113)
87 |
--------------------------------------------------------------------------------
/2-LoadPluginClass/host/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/
5 | .DS_Store
6 | /build
7 | /captures
8 | .externalNativeBuild
9 |
--------------------------------------------------------------------------------
/2-LoadPluginClass/host/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/2-LoadPluginClass/host/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 24
5 | buildToolsVersion "24.0.3"
6 | defaultConfig {
7 | applicationId "com.example.loadpluginclass"
8 | minSdkVersion 21
9 | targetSdkVersion 24
10 | versionCode 1
11 | versionName "1.0"
12 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
13 | }
14 | buildTypes {
15 | release {
16 | minifyEnabled false
17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18 | }
19 | }
20 | }
21 |
22 | dependencies {
23 | compile fileTree(dir: 'libs', include: ['*.jar'])
24 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
25 | exclude group: 'com.android.support', module: 'support-annotations'
26 | })
27 | compile 'com.android.support:appcompat-v7:24.2.1'
28 | testCompile 'junit:junit:4.12'
29 | }
30 |
--------------------------------------------------------------------------------
/2-LoadPluginClass/host/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /Users/2bab/Dependence/sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/2-LoadPluginClass/host/app/src/androidTest/java/com/example/loadpluginclass/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.example.loadpluginclass;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumentation test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() throws Exception {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("com.example.loadpluginclass", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/2-LoadPluginClass/host/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/2-LoadPluginClass/host/app/src/main/java/com/example/loadpluginclass/LoadPluginClassTestInterface.java:
--------------------------------------------------------------------------------
1 | package com.example.loadpluginclass;
2 |
3 | /**
4 | * Created by 2bab on 2016/11/15.
5 | */
6 |
7 | public interface LoadPluginClassTestInterface {
8 |
9 | float getPiValue();
10 |
11 | }
12 |
--------------------------------------------------------------------------------
/2-LoadPluginClass/host/app/src/main/java/com/example/loadpluginclass/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.example.loadpluginclass;
2 |
3 | import android.os.Bundle;
4 | import android.support.v7.app.AppCompatActivity;
5 | import android.widget.Toast;
6 |
7 | import java.io.File;
8 |
9 | import dalvik.system.DexClassLoader;
10 |
11 | public class MainActivity extends AppCompatActivity {
12 |
13 | private DexClassLoader dexClassLoader;
14 |
15 | @Override
16 | protected void onCreate(Bundle savedInstanceState) {
17 | super.onCreate(savedInstanceState);
18 | setContentView(R.layout.activity_main);
19 |
20 | installDex();
21 | loadPluginClassTest();
22 | }
23 |
24 | private void installDex() {
25 | File optimizedDexOutputPath = new File("/system/dex/" + "2-LoadPluginClass.apk");// 外部路径
26 | File dexOutputDir = this.getDir("dex", 0);// 无法直接从外部路径加载.dex文件,需要指定APP内部路径作为缓存目录(.dex文件会被解压到此目录)
27 | dexClassLoader = new DexClassLoader(
28 | optimizedDexOutputPath.getAbsolutePath(),
29 | dexOutputDir.getAbsolutePath(),
30 | null,
31 | getClassLoader());
32 | }
33 |
34 | private void loadPluginClassTest() {
35 | try {
36 | Class libProviderClazz = dexClassLoader.loadClass("com.example.loadpluginclass.PluginClassWillBeLoad");
37 | System.out.println("PluginClassWillBeLoad getClassloader:" + libProviderClazz.getClassLoader());
38 | System.out.println("LoadPluginClassTestInterface getClassloader:" + LoadPluginClassTestInterface.class.getClassLoader());
39 |
40 | LoadPluginClassTestInterface dexInterface = (LoadPluginClassTestInterface) libProviderClazz.newInstance();
41 | Toast.makeText(this, dexInterface.getPiValue() + "", Toast.LENGTH_LONG).show();
42 | } catch (Exception e) {
43 | e.printStackTrace();
44 | }
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/2-LoadPluginClass/host/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
12 |
13 |
17 |
18 |
--------------------------------------------------------------------------------
/2-LoadPluginClass/host/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2BAB/Android-Dynamic-Loading-Notes/dc6cd3e7aae2c9b5332ce743f247ef194b35f90f/2-LoadPluginClass/host/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/2-LoadPluginClass/host/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2BAB/Android-Dynamic-Loading-Notes/dc6cd3e7aae2c9b5332ce743f247ef194b35f90f/2-LoadPluginClass/host/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/2-LoadPluginClass/host/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2BAB/Android-Dynamic-Loading-Notes/dc6cd3e7aae2c9b5332ce743f247ef194b35f90f/2-LoadPluginClass/host/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/2-LoadPluginClass/host/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2BAB/Android-Dynamic-Loading-Notes/dc6cd3e7aae2c9b5332ce743f247ef194b35f90f/2-LoadPluginClass/host/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/2-LoadPluginClass/host/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2BAB/Android-Dynamic-Loading-Notes/dc6cd3e7aae2c9b5332ce743f247ef194b35f90f/2-LoadPluginClass/host/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/2-LoadPluginClass/host/app/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/2-LoadPluginClass/host/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/2-LoadPluginClass/host/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 |
6 |
--------------------------------------------------------------------------------
/2-LoadPluginClass/host/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | LoadPluginClass
3 |
4 |
--------------------------------------------------------------------------------
/2-LoadPluginClass/host/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/2-LoadPluginClass/host/app/src/test/java/com/example/loadpluginclass/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.example.loadpluginclass;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() throws Exception {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/2-LoadPluginClass/host/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | repositories {
5 | jcenter()
6 | }
7 | dependencies {
8 | classpath 'com.android.tools.build:gradle:2.2.2'
9 |
10 | // NOTE: Do not place your application dependencies here; they belong
11 | // in the individual module build.gradle files
12 | }
13 | }
14 |
15 | allprojects {
16 | repositories {
17 | jcenter()
18 | }
19 | }
20 |
21 | task clean(type: Delete) {
22 | delete rootProject.buildDir
23 | }
24 |
--------------------------------------------------------------------------------
/2-LoadPluginClass/host/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | org.gradle.jvmargs=-Xmx1536m
13 |
14 | # When configured, Gradle will run in incubating parallel mode.
15 | # This option should only be used with decoupled projects. More details, visit
16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
17 | # org.gradle.parallel=true
18 |
--------------------------------------------------------------------------------
/2-LoadPluginClass/host/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2BAB/Android-Dynamic-Loading-Notes/dc6cd3e7aae2c9b5332ce743f247ef194b35f90f/2-LoadPluginClass/host/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/2-LoadPluginClass/host/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Mon Dec 28 10:00:20 PST 2015
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
7 |
--------------------------------------------------------------------------------
/2-LoadPluginClass/host/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------
/2-LoadPluginClass/plugin/origin.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2BAB/Android-Dynamic-Loading-Notes/dc6cd3e7aae2c9b5332ce743f247ef194b35f90f/2-LoadPluginClass/plugin/origin.jar
--------------------------------------------------------------------------------
/2-LoadPluginClass/plugin/src/com/example/loadpluginclass/LoadPluginClassTestInterface.java:
--------------------------------------------------------------------------------
1 | package com.example.loadpluginclass;
2 |
3 | /**
4 | * Created by 2bab on 2016/11/15.
5 | */
6 |
7 | public interface LoadPluginClassTestInterface {
8 |
9 | float getPiValue();
10 |
11 | }
12 |
--------------------------------------------------------------------------------
/2-LoadPluginClass/plugin/src/com/example/loadpluginclass/PluginClassWillBeLoad.java:
--------------------------------------------------------------------------------
1 | package com.example.loadpluginclass;
2 |
3 | /**
4 | * Created by 2bab on 2016/11/15.
5 | */
6 |
7 | public class PluginClassWillBeLoad implements LoadPluginClassTestInterface{
8 |
9 | @Override
10 | public float getPiValue() {
11 | return 3.14f;
12 | }
13 |
14 | }
15 |
--------------------------------------------------------------------------------
/2-LoadPluginClass/pluginByApk/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/
5 | .DS_Store
6 | /build
7 | /captures
8 | .externalNativeBuild
9 |
--------------------------------------------------------------------------------
/2-LoadPluginClass/pluginByApk/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/2-LoadPluginClass/pluginByApk/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 24
5 | buildToolsVersion "24.0.3"
6 | defaultConfig {
7 | applicationId "com.example.loadpluginclass"
8 | minSdkVersion 21
9 | targetSdkVersion 24
10 | versionCode 1
11 | versionName "1.0"
12 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
13 | }
14 | buildTypes {
15 | release {
16 | minifyEnabled false
17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18 | }
19 | }
20 | }
21 |
22 | dependencies {
23 | compile fileTree(dir: 'libs', include: ['*.jar'])
24 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
25 | exclude group: 'com.android.support', module: 'support-annotations'
26 | })
27 | compile 'com.android.support:appcompat-v7:24.2.1'
28 | testCompile 'junit:junit:4.12'
29 | }
30 |
--------------------------------------------------------------------------------
/2-LoadPluginClass/pluginByApk/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /Users/2bab/Dependence/sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/2-LoadPluginClass/pluginByApk/app/src/androidTest/java/com/example/loadpluginclass/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.example.loadpluginclass;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumentation test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() throws Exception {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("com.example.loadpluginclass", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/2-LoadPluginClass/pluginByApk/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/2-LoadPluginClass/pluginByApk/app/src/main/java/com/example/loadpluginclass/LoadPluginClassTestInterface.java:
--------------------------------------------------------------------------------
1 | package com.example.loadpluginclass;
2 |
3 | /**
4 | * Created by 2bab on 2016/11/15.
5 | */
6 |
7 | public interface LoadPluginClassTestInterface {
8 |
9 | float getPiValue();
10 |
11 | }
12 |
--------------------------------------------------------------------------------
/2-LoadPluginClass/pluginByApk/app/src/main/java/com/example/loadpluginclass/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.example.loadpluginclass;
2 |
3 | import android.support.v7.app.AppCompatActivity;
4 | import android.os.Bundle;
5 |
6 | public class MainActivity extends AppCompatActivity {
7 |
8 | @Override
9 | protected void onCreate(Bundle savedInstanceState) {
10 | super.onCreate(savedInstanceState);
11 | setContentView(R.layout.activity_main);
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/2-LoadPluginClass/pluginByApk/app/src/main/java/com/example/loadpluginclass/PluginClassWillBeLoad.java:
--------------------------------------------------------------------------------
1 | package com.example.loadpluginclass;
2 |
3 | /**
4 | * Created by 2bab on 2016/11/15.
5 | */
6 |
7 | public class PluginClassWillBeLoad implements LoadPluginClassTestInterface{
8 |
9 | @Override
10 | public float getPiValue() {
11 | return 3.14f;
12 | }
13 |
14 | }
15 |
--------------------------------------------------------------------------------
/2-LoadPluginClass/pluginByApk/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
12 |
13 |
17 |
18 |
--------------------------------------------------------------------------------
/2-LoadPluginClass/pluginByApk/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2BAB/Android-Dynamic-Loading-Notes/dc6cd3e7aae2c9b5332ce743f247ef194b35f90f/2-LoadPluginClass/pluginByApk/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/2-LoadPluginClass/pluginByApk/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2BAB/Android-Dynamic-Loading-Notes/dc6cd3e7aae2c9b5332ce743f247ef194b35f90f/2-LoadPluginClass/pluginByApk/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/2-LoadPluginClass/pluginByApk/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2BAB/Android-Dynamic-Loading-Notes/dc6cd3e7aae2c9b5332ce743f247ef194b35f90f/2-LoadPluginClass/pluginByApk/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/2-LoadPluginClass/pluginByApk/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2BAB/Android-Dynamic-Loading-Notes/dc6cd3e7aae2c9b5332ce743f247ef194b35f90f/2-LoadPluginClass/pluginByApk/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/2-LoadPluginClass/pluginByApk/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2BAB/Android-Dynamic-Loading-Notes/dc6cd3e7aae2c9b5332ce743f247ef194b35f90f/2-LoadPluginClass/pluginByApk/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/2-LoadPluginClass/pluginByApk/app/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/2-LoadPluginClass/pluginByApk/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/2-LoadPluginClass/pluginByApk/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 |
6 |
--------------------------------------------------------------------------------
/2-LoadPluginClass/pluginByApk/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | LoadPluginClass
3 |
4 |
--------------------------------------------------------------------------------
/2-LoadPluginClass/pluginByApk/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/2-LoadPluginClass/pluginByApk/app/src/test/java/com/example/loadpluginclass/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.example.loadpluginclass;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() throws Exception {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/2-LoadPluginClass/pluginByApk/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | repositories {
5 | jcenter()
6 | }
7 | dependencies {
8 | classpath 'com.android.tools.build:gradle:2.2.2'
9 |
10 | // NOTE: Do not place your application dependencies here; they belong
11 | // in the individual module build.gradle files
12 | }
13 | }
14 |
15 | allprojects {
16 | repositories {
17 | jcenter()
18 | }
19 | }
20 |
21 | task clean(type: Delete) {
22 | delete rootProject.buildDir
23 | }
24 |
--------------------------------------------------------------------------------
/2-LoadPluginClass/pluginByApk/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | org.gradle.jvmargs=-Xmx1536m
13 |
14 | # When configured, Gradle will run in incubating parallel mode.
15 | # This option should only be used with decoupled projects. More details, visit
16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
17 | # org.gradle.parallel=true
18 |
--------------------------------------------------------------------------------
/2-LoadPluginClass/pluginByApk/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2BAB/Android-Dynamic-Loading-Notes/dc6cd3e7aae2c9b5332ce743f247ef194b35f90f/2-LoadPluginClass/pluginByApk/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/2-LoadPluginClass/pluginByApk/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Mon Dec 28 10:00:20 PST 2015
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
7 |
--------------------------------------------------------------------------------
/2-LoadPluginClass/pluginByApk/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------
/3-StartPluginActivity/host/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/
5 | .DS_Store
6 | /build
7 | /captures
8 | .externalNativeBuild
9 |
--------------------------------------------------------------------------------
/3-StartPluginActivity/host/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/3-StartPluginActivity/host/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 24
5 | buildToolsVersion "24.0.3"
6 | defaultConfig {
7 | applicationId "com.example.startpluginactivity"
8 | minSdkVersion 21
9 | targetSdkVersion 24
10 | versionCode 1
11 | versionName "1.0"
12 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
13 | }
14 | buildTypes {
15 | release {
16 | minifyEnabled false
17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18 | }
19 | }
20 | }
21 |
22 | dependencies {
23 | compile fileTree(dir: 'libs', include: ['*.jar'])
24 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
25 | exclude group: 'com.android.support', module: 'support-annotations'
26 | })
27 | compile 'com.android.support:appcompat-v7:24.2.1'
28 | testCompile 'junit:junit:4.12'
29 | }
30 |
--------------------------------------------------------------------------------
/3-StartPluginActivity/host/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /Users/2bab/Dependence/sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/3-StartPluginActivity/host/app/src/androidTest/java/com/example/startpluginactivity/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.example.startpluginactivity;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumentation test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() throws Exception {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("com.example.startpluginactivity", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/3-StartPluginActivity/host/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/3-StartPluginActivity/host/app/src/main/java/com/example/startpluginactivity/CustomInstrumentation.java:
--------------------------------------------------------------------------------
1 | package com.example.startpluginactivity;
2 |
3 | import android.app.Activity;
4 | import android.app.Instrumentation;
5 | import android.content.Intent;
6 |
7 | /**
8 | * Created by 2bab on 2016/11/15.
9 | */
10 |
11 | public class CustomInstrumentation extends Instrumentation {
12 |
13 | private ClassLoader customClassloader;
14 | private Instrumentation base;
15 |
16 | public CustomInstrumentation(Instrumentation base, ClassLoader classLoader) {
17 | this.base = base; // 如果要不注册 Activity 就能启动的方式,那么还需要 hook execStartActivity 等方法,此时会用到这个 base 的 Instrumentation
18 | customClassloader = classLoader;
19 | }
20 |
21 | @Override
22 | public Activity newActivity(ClassLoader cl, String className, Intent intent) throws InstantiationException, IllegalAccessException, ClassNotFoundException {
23 | return super.newActivity(customClassloader, className, intent);
24 | }
25 |
26 | }
27 |
--------------------------------------------------------------------------------
/3-StartPluginActivity/host/app/src/main/java/com/example/startpluginactivity/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.example.startpluginactivity;
2 |
3 | import android.content.Intent;
4 | import android.os.Bundle;
5 | import android.os.Handler;
6 | import android.support.v7.app.AppCompatActivity;
7 |
8 | public class MainActivity extends AppCompatActivity {
9 |
10 | @Override
11 | protected void onCreate(Bundle savedInstanceState) {
12 | super.onCreate(savedInstanceState);
13 | setContentView(R.layout.activity_main);
14 |
15 | Handler handler = new Handler();
16 | handler.postDelayed(goToPluginActivity, 3000);
17 | }
18 |
19 | Runnable goToPluginActivity = new Runnable() {
20 | @Override
21 | public void run() {
22 | try {
23 | // 启动 Plugin Activity
24 | Intent intent = new Intent(MainActivity.this, MyApplication.dexClassLoader.loadClass("com.example.plugin3.MainActivity"));
25 | startActivity(intent);
26 | } catch (Exception e) {
27 | e.printStackTrace();
28 | }
29 | }
30 | };
31 | }
32 |
--------------------------------------------------------------------------------
/3-StartPluginActivity/host/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
12 |
13 |
17 |
18 |
--------------------------------------------------------------------------------
/3-StartPluginActivity/host/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2BAB/Android-Dynamic-Loading-Notes/dc6cd3e7aae2c9b5332ce743f247ef194b35f90f/3-StartPluginActivity/host/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/3-StartPluginActivity/host/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2BAB/Android-Dynamic-Loading-Notes/dc6cd3e7aae2c9b5332ce743f247ef194b35f90f/3-StartPluginActivity/host/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/3-StartPluginActivity/host/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2BAB/Android-Dynamic-Loading-Notes/dc6cd3e7aae2c9b5332ce743f247ef194b35f90f/3-StartPluginActivity/host/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/3-StartPluginActivity/host/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2BAB/Android-Dynamic-Loading-Notes/dc6cd3e7aae2c9b5332ce743f247ef194b35f90f/3-StartPluginActivity/host/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/3-StartPluginActivity/host/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2BAB/Android-Dynamic-Loading-Notes/dc6cd3e7aae2c9b5332ce743f247ef194b35f90f/3-StartPluginActivity/host/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/3-StartPluginActivity/host/app/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/3-StartPluginActivity/host/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/3-StartPluginActivity/host/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 |
6 |
--------------------------------------------------------------------------------
/3-StartPluginActivity/host/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | StartPluginActivity
3 |
4 |
--------------------------------------------------------------------------------
/3-StartPluginActivity/host/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/3-StartPluginActivity/host/app/src/test/java/com/example/startpluginactivity/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.example.startpluginactivity;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() throws Exception {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/3-StartPluginActivity/host/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | repositories {
5 | jcenter()
6 | }
7 | dependencies {
8 | classpath 'com.android.tools.build:gradle:2.2.2'
9 |
10 | // NOTE: Do not place your application dependencies here; they belong
11 | // in the individual module build.gradle files
12 | }
13 | }
14 |
15 | allprojects {
16 | repositories {
17 | jcenter()
18 | }
19 | }
20 |
21 | task clean(type: Delete) {
22 | delete rootProject.buildDir
23 | }
24 |
--------------------------------------------------------------------------------
/3-StartPluginActivity/host/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | org.gradle.jvmargs=-Xmx1536m
13 |
14 | # When configured, Gradle will run in incubating parallel mode.
15 | # This option should only be used with decoupled projects. More details, visit
16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
17 | # org.gradle.parallel=true
18 |
--------------------------------------------------------------------------------
/3-StartPluginActivity/host/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2BAB/Android-Dynamic-Loading-Notes/dc6cd3e7aae2c9b5332ce743f247ef194b35f90f/3-StartPluginActivity/host/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/3-StartPluginActivity/host/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Mon Dec 28 10:00:20 PST 2015
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
7 |
--------------------------------------------------------------------------------
/3-StartPluginActivity/host/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------
/3-StartPluginActivity/plugin/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/
5 | .DS_Store
6 | /build
7 | /captures
8 | .externalNativeBuild
9 |
--------------------------------------------------------------------------------
/3-StartPluginActivity/plugin/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/3-StartPluginActivity/plugin/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 24
5 | buildToolsVersion "24.0.3"
6 | defaultConfig {
7 | applicationId "com.example.plugin3"
8 | minSdkVersion 21
9 | targetSdkVersion 24
10 | versionCode 1
11 | versionName "1.0"
12 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
13 | }
14 | buildTypes {
15 | release {
16 | minifyEnabled false
17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18 | }
19 | }
20 | }
21 |
22 | dependencies {
23 | compile fileTree(dir: 'libs', include: ['*.jar'])
24 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
25 | exclude group: 'com.android.support', module: 'support-annotations'
26 | })
27 | compile 'com.android.support:appcompat-v7:24.2.1'
28 | testCompile 'junit:junit:4.12'
29 | }
30 |
--------------------------------------------------------------------------------
/3-StartPluginActivity/plugin/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /Users/2bab/Dependence/sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/3-StartPluginActivity/plugin/app/src/androidTest/java/com/example/plugin3/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.example.plugin3;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumentation test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() throws Exception {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("com.example.plugin3", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/3-StartPluginActivity/plugin/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/3-StartPluginActivity/plugin/app/src/main/java/com/example/plugin3/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.example.plugin3;
2 |
3 | import android.graphics.Color;
4 | import android.support.v7.app.AppCompatActivity;
5 | import android.os.Bundle;
6 | import android.widget.Button;
7 | import android.widget.RelativeLayout;
8 |
9 | public class MainActivity extends AppCompatActivity {
10 |
11 | @Override
12 | protected void onCreate(Bundle savedInstanceState) {
13 | super.onCreate(savedInstanceState);
14 |
15 | RelativeLayout root = new RelativeLayout(this);
16 | root.setBackgroundColor(Color.BLUE);
17 | Button button = new Button(this);
18 | button.setText("I'm Plugin Activity");
19 | root.addView(button);
20 | setContentView(root);
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/3-StartPluginActivity/plugin/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
12 |
13 |
17 |
18 |
--------------------------------------------------------------------------------
/3-StartPluginActivity/plugin/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2BAB/Android-Dynamic-Loading-Notes/dc6cd3e7aae2c9b5332ce743f247ef194b35f90f/3-StartPluginActivity/plugin/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/3-StartPluginActivity/plugin/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2BAB/Android-Dynamic-Loading-Notes/dc6cd3e7aae2c9b5332ce743f247ef194b35f90f/3-StartPluginActivity/plugin/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/3-StartPluginActivity/plugin/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2BAB/Android-Dynamic-Loading-Notes/dc6cd3e7aae2c9b5332ce743f247ef194b35f90f/3-StartPluginActivity/plugin/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/3-StartPluginActivity/plugin/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2BAB/Android-Dynamic-Loading-Notes/dc6cd3e7aae2c9b5332ce743f247ef194b35f90f/3-StartPluginActivity/plugin/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/3-StartPluginActivity/plugin/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2BAB/Android-Dynamic-Loading-Notes/dc6cd3e7aae2c9b5332ce743f247ef194b35f90f/3-StartPluginActivity/plugin/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/3-StartPluginActivity/plugin/app/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/3-StartPluginActivity/plugin/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/3-StartPluginActivity/plugin/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 |
6 |
--------------------------------------------------------------------------------
/3-StartPluginActivity/plugin/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Plugin3
3 |
4 |
--------------------------------------------------------------------------------
/3-StartPluginActivity/plugin/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/3-StartPluginActivity/plugin/app/src/test/java/com/example/plugin3/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.example.plugin3;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() throws Exception {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/3-StartPluginActivity/plugin/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | repositories {
5 | jcenter()
6 | }
7 | dependencies {
8 | classpath 'com.android.tools.build:gradle:2.2.2'
9 |
10 | // NOTE: Do not place your application dependencies here; they belong
11 | // in the individual module build.gradle files
12 | }
13 | }
14 |
15 | allprojects {
16 | repositories {
17 | jcenter()
18 | }
19 | }
20 |
21 | task clean(type: Delete) {
22 | delete rootProject.buildDir
23 | }
24 |
--------------------------------------------------------------------------------
/3-StartPluginActivity/plugin/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | org.gradle.jvmargs=-Xmx1536m
13 |
14 | # When configured, Gradle will run in incubating parallel mode.
15 | # This option should only be used with decoupled projects. More details, visit
16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
17 | # org.gradle.parallel=true
18 |
--------------------------------------------------------------------------------
/3-StartPluginActivity/plugin/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2BAB/Android-Dynamic-Loading-Notes/dc6cd3e7aae2c9b5332ce743f247ef194b35f90f/3-StartPluginActivity/plugin/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/3-StartPluginActivity/plugin/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Mon Dec 28 10:00:20 PST 2015
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
7 |
--------------------------------------------------------------------------------
/3-StartPluginActivity/plugin/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------
/4-LoadPluginResource/host/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/
5 | .DS_Store
6 | /build
7 | /captures
8 | .externalNativeBuild
9 |
--------------------------------------------------------------------------------
/4-LoadPluginResource/host/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/4-LoadPluginResource/host/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 25
5 | buildToolsVersion "25.0.2"
6 | defaultConfig {
7 | applicationId "com.example.loadpluginresource"
8 | minSdkVersion 16
9 | targetSdkVersion 25
10 | versionCode 1
11 | versionName "1.0"
12 | }
13 | buildTypes {
14 | release {
15 | minifyEnabled false
16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
17 | }
18 | }
19 | }
20 |
21 | dependencies {
22 | compile fileTree(dir: 'libs', include: ['*.jar'])
23 | compile 'com.android.support:appcompat-v7:25.3.1'
24 | }
25 |
--------------------------------------------------------------------------------
/4-LoadPluginResource/host/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /Users/2bab/Dependence/sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/4-LoadPluginResource/host/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
9 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/4-LoadPluginResource/host/app/src/main/java/com/example/loadpluginresource/CustomInstrumentation.java:
--------------------------------------------------------------------------------
1 | package com.example.loadpluginresource;
2 |
3 | import android.app.Activity;
4 | import android.app.Instrumentation;
5 | import android.content.Intent;
6 |
7 | /**
8 | * Created by 2bab on 2016/11/15.
9 | */
10 |
11 | public class CustomInstrumentation extends Instrumentation {
12 |
13 | private ClassLoader customClassloader;
14 | private Instrumentation base;
15 |
16 | public CustomInstrumentation(Instrumentation base, ClassLoader classLoader) {
17 | this.base = base; // 如果要不注册 Activity 就能启动的方式,那么还需要 hook execStartActivity 等方法,此时会用到这个 base 的 Instrumentation
18 | customClassloader = classLoader;
19 | }
20 |
21 | @Override
22 | public Activity newActivity(ClassLoader cl, String className, Intent intent) throws InstantiationException, IllegalAccessException, ClassNotFoundException {
23 | return super.newActivity(customClassloader, className, intent);
24 | }
25 |
26 | }
27 |
--------------------------------------------------------------------------------
/4-LoadPluginResource/host/app/src/main/java/com/example/loadpluginresource/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.example.loadpluginresource;
2 |
3 | import android.content.Intent;
4 | import android.os.Bundle;
5 | import android.os.Handler;
6 | import android.support.v7.app.AppCompatActivity;
7 |
8 | public class MainActivity extends AppCompatActivity {
9 |
10 | @Override
11 | protected void onCreate(Bundle savedInstanceState) {
12 | super.onCreate(savedInstanceState);
13 | setContentView(R.layout.activity_main);
14 |
15 | Handler handler = new Handler();
16 | handler.postDelayed(goToPluginActivity, 1500);
17 | }
18 |
19 | Runnable goToPluginActivity = new Runnable() {
20 | @Override
21 | public void run() {
22 | try {
23 | // 启动 Plugin Activity
24 | Intent intent = new Intent(MainActivity.this, MyApplication.dexClassLoader.loadClass("com.example.plugin4.MainActivity"));
25 | startActivity(intent);
26 | } catch (Exception e) {
27 | e.printStackTrace();
28 | }
29 | }
30 | };
31 | }
32 |
--------------------------------------------------------------------------------
/4-LoadPluginResource/host/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
12 |
13 |
17 |
18 |
--------------------------------------------------------------------------------
/4-LoadPluginResource/host/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2BAB/Android-Dynamic-Loading-Notes/dc6cd3e7aae2c9b5332ce743f247ef194b35f90f/4-LoadPluginResource/host/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/4-LoadPluginResource/host/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2BAB/Android-Dynamic-Loading-Notes/dc6cd3e7aae2c9b5332ce743f247ef194b35f90f/4-LoadPluginResource/host/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/4-LoadPluginResource/host/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2BAB/Android-Dynamic-Loading-Notes/dc6cd3e7aae2c9b5332ce743f247ef194b35f90f/4-LoadPluginResource/host/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/4-LoadPluginResource/host/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2BAB/Android-Dynamic-Loading-Notes/dc6cd3e7aae2c9b5332ce743f247ef194b35f90f/4-LoadPluginResource/host/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/4-LoadPluginResource/host/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2BAB/Android-Dynamic-Loading-Notes/dc6cd3e7aae2c9b5332ce743f247ef194b35f90f/4-LoadPluginResource/host/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/4-LoadPluginResource/host/app/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/4-LoadPluginResource/host/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/4-LoadPluginResource/host/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 |
6 |
--------------------------------------------------------------------------------
/4-LoadPluginResource/host/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | LoadPluginResource
3 |
4 |
--------------------------------------------------------------------------------
/4-LoadPluginResource/host/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/4-LoadPluginResource/host/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | repositories {
5 | jcenter()
6 | }
7 | dependencies {
8 | classpath 'com.android.tools.build:gradle:2.2.2'
9 |
10 | // NOTE: Do not place your application dependencies here; they belong
11 | // in the individual module build.gradle files
12 | }
13 | }
14 |
15 | allprojects {
16 | repositories {
17 | jcenter()
18 | }
19 | }
20 |
21 | task clean(type: Delete) {
22 | delete rootProject.buildDir
23 | }
24 |
--------------------------------------------------------------------------------
/4-LoadPluginResource/host/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | org.gradle.jvmargs=-Xmx1536m
13 |
14 | # When configured, Gradle will run in incubating parallel mode.
15 | # This option should only be used with decoupled projects. More details, visit
16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
17 | # org.gradle.parallel=true
18 |
--------------------------------------------------------------------------------
/4-LoadPluginResource/host/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2BAB/Android-Dynamic-Loading-Notes/dc6cd3e7aae2c9b5332ce743f247ef194b35f90f/4-LoadPluginResource/host/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/4-LoadPluginResource/host/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Mon Dec 28 10:00:20 PST 2015
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
7 |
--------------------------------------------------------------------------------
/4-LoadPluginResource/host/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------
/4-LoadPluginResource/plugin/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/
5 | .DS_Store
6 | /build
7 | /captures
8 | .externalNativeBuild
9 |
--------------------------------------------------------------------------------
/4-LoadPluginResource/plugin/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/4-LoadPluginResource/plugin/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /Users/2bab/Dependence/sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/4-LoadPluginResource/plugin/app/src/androidTest/java/com/example/plugin4/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.example.plugin4;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumentation test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() throws Exception {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("com.example.plugin4", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/4-LoadPluginResource/plugin/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/4-LoadPluginResource/plugin/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
14 |
15 |
19 |
20 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/4-LoadPluginResource/plugin/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2BAB/Android-Dynamic-Loading-Notes/dc6cd3e7aae2c9b5332ce743f247ef194b35f90f/4-LoadPluginResource/plugin/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/4-LoadPluginResource/plugin/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2BAB/Android-Dynamic-Loading-Notes/dc6cd3e7aae2c9b5332ce743f247ef194b35f90f/4-LoadPluginResource/plugin/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/4-LoadPluginResource/plugin/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2BAB/Android-Dynamic-Loading-Notes/dc6cd3e7aae2c9b5332ce743f247ef194b35f90f/4-LoadPluginResource/plugin/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/4-LoadPluginResource/plugin/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2BAB/Android-Dynamic-Loading-Notes/dc6cd3e7aae2c9b5332ce743f247ef194b35f90f/4-LoadPluginResource/plugin/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/4-LoadPluginResource/plugin/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2BAB/Android-Dynamic-Loading-Notes/dc6cd3e7aae2c9b5332ce743f247ef194b35f90f/4-LoadPluginResource/plugin/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/4-LoadPluginResource/plugin/app/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/4-LoadPluginResource/plugin/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/4-LoadPluginResource/plugin/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 |
6 |
--------------------------------------------------------------------------------
/4-LoadPluginResource/plugin/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Plugin4
3 | Hello Plugin Resource!
4 |
5 |
--------------------------------------------------------------------------------
/4-LoadPluginResource/plugin/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/4-LoadPluginResource/plugin/app/src/test/java/com/example/plugin4/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.example.plugin4;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() throws Exception {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/4-LoadPluginResource/plugin/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | repositories {
5 | jcenter()
6 | }
7 | dependencies {
8 | classpath 'com.android.tools.build:gradle:2.3.3'
9 |
10 | // NOTE: Do not place your application dependencies here; they belong
11 | // in the individual module build.gradle files
12 | }
13 | }
14 |
15 | allprojects {
16 | repositories {
17 | jcenter()
18 | }
19 | }
20 |
21 | task clean(type: Delete) {
22 | delete rootProject.buildDir
23 | }
24 |
--------------------------------------------------------------------------------
/4-LoadPluginResource/plugin/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | org.gradle.jvmargs=-Xmx1536m
13 |
14 | # When configured, Gradle will run in incubating parallel mode.
15 | # This option should only be used with decoupled projects. More details, visit
16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
17 | # org.gradle.parallel=true
18 |
--------------------------------------------------------------------------------
/4-LoadPluginResource/plugin/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2BAB/Android-Dynamic-Loading-Notes/dc6cd3e7aae2c9b5332ce743f247ef194b35f90f/4-LoadPluginResource/plugin/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/4-LoadPluginResource/plugin/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Mon Oct 30 14:26:33 CST 2017
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
7 |
--------------------------------------------------------------------------------
/4-LoadPluginResource/plugin/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------
/5-ResModificationPlugin/host/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/
5 | .DS_Store
6 | /build
7 | /captures
8 | .externalNativeBuild
--------------------------------------------------------------------------------
/5-ResModificationPlugin/host/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/5-ResModificationPlugin/host/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 24
5 | buildToolsVersion "24.0.3"
6 | defaultConfig {
7 | applicationId "com.example.resmodification"
8 | minSdkVersion 21
9 | targetSdkVersion 24
10 | versionCode 1
11 | versionName "1.0"
12 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
13 | }
14 | buildTypes {
15 | release {
16 | minifyEnabled false
17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18 | }
19 | }
20 | }
21 |
22 | dependencies {
23 | compile fileTree(dir: 'libs', include: ['*.jar'])
24 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
25 | exclude group: 'com.android.support', module: 'support-annotations'
26 | })
27 | compile 'com.android.support:appcompat-v7:24.2.1'
28 | testCompile 'junit:junit:4.12'
29 | }
30 |
--------------------------------------------------------------------------------
/5-ResModificationPlugin/host/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /Users/2bab/Dependence/sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/5-ResModificationPlugin/host/app/src/androidTest/java/com/example/resmodification/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.example.resmodification;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumentation test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() throws Exception {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("com.example.resmodification", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/5-ResModificationPlugin/host/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/5-ResModificationPlugin/host/app/src/main/java/com/example/resmodification/CustomInstrumentation.java:
--------------------------------------------------------------------------------
1 | package com.example.resmodification;
2 |
3 | import android.app.Activity;
4 | import android.app.Instrumentation;
5 | import android.content.Intent;
6 |
7 | /**
8 | * Created by 2bab on 2016/11/15.
9 | */
10 |
11 | public class CustomInstrumentation extends Instrumentation {
12 |
13 | private ClassLoader customClassloader;
14 | private Instrumentation base;
15 |
16 | public CustomInstrumentation(Instrumentation base, ClassLoader classLoader) {
17 | this.base = base; // 如果要不注册 Activity 就能启动的方式,那么还需要 hook execStartActivity 等方法,此时会用到这个 base 的 Instrumentation
18 | customClassloader = classLoader;
19 | }
20 |
21 | @Override
22 | public Activity newActivity(ClassLoader cl, String className, Intent intent) throws InstantiationException, IllegalAccessException, ClassNotFoundException {
23 | return super.newActivity(customClassloader, className, intent);
24 | }
25 |
26 | }
27 |
--------------------------------------------------------------------------------
/5-ResModificationPlugin/host/app/src/main/java/com/example/resmodification/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.example.resmodification;
2 |
3 | import android.content.Intent;
4 | import android.os.Bundle;
5 | import android.os.Handler;
6 | import android.support.v7.app.AppCompatActivity;
7 |
8 | public class MainActivity extends AppCompatActivity {
9 |
10 | @Override
11 | protected void onCreate(Bundle savedInstanceState) {
12 | super.onCreate(savedInstanceState);
13 | setContentView(R.layout.activity_main);
14 |
15 | Handler handler = new Handler();
16 | handler.postDelayed(goToPluginActivity, 3000);
17 | }
18 |
19 | Runnable goToPluginActivity = new Runnable() {
20 | @Override
21 | public void run() {
22 | try {
23 | // 启动 Plugin Activity
24 | Intent intent = new Intent(MainActivity.this, MyApplication.dexClassLoader.loadClass("com.example.plugin5.MainActivity"));
25 | startActivity(intent);
26 | } catch (Exception e) {
27 | e.printStackTrace();
28 | }
29 | }
30 | };
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/5-ResModificationPlugin/host/app/src/main/java/com/example/resmodification/MyApplication.java:
--------------------------------------------------------------------------------
1 | package com.example.resmodification;
2 |
3 | import android.app.Application;
4 | import android.app.Instrumentation;
5 | import android.content.Context;
6 |
7 | import java.io.File;
8 | import java.lang.reflect.Field;
9 | import java.lang.reflect.Method;
10 |
11 | import dalvik.system.DexClassLoader;
12 |
13 | /**
14 | * Created by 2bab on 2016/11/15.
15 | */
16 |
17 | public class MyApplication extends Application {
18 |
19 | public static DexClassLoader dexClassLoader;
20 |
21 | @Override
22 | protected void attachBaseContext(Context base) {
23 | super.attachBaseContext(base);
24 | installDex();
25 | hookInstrumentation();
26 | }
27 |
28 | private void installDex() {
29 | File optimizedDexOutputPath = new File("/system/dex/" + "5-Plugin.apk");// 外部路径
30 | File dexOutputDir = this.getDir("dex", 0);// 无法直接从外部路径加载.dex文件,需要指定APP内部路径作为缓存目录(.dex文件会被解压到此目录)
31 | dexClassLoader = new DexClassLoader(
32 | optimizedDexOutputPath.getAbsolutePath(),
33 | dexOutputDir.getAbsolutePath(),
34 | null,
35 | getClassLoader());
36 | }
37 |
38 | private void hookInstrumentation() {
39 | try {
40 | Class> activityThreadClass = Class.forName("android.app.ActivityThread");
41 | Method currentActivityThreadMethod = activityThreadClass.getDeclaredMethod("currentActivityThread");
42 | currentActivityThreadMethod.setAccessible(true);
43 | Object currentActivityThread = currentActivityThreadMethod.invoke(null);
44 |
45 | // 拿到原始的 mInstrumentation字段
46 | Field mInstrumentationField = activityThreadClass.getDeclaredField("mInstrumentation");
47 | mInstrumentationField.setAccessible(true);
48 | Instrumentation mInstrumentation = (Instrumentation) mInstrumentationField.get(currentActivityThread);
49 |
50 | //如果没有注入过,就执行替换
51 | if (!(mInstrumentation instanceof CustomInstrumentation)) {
52 | CustomInstrumentation pluginInstrumentation = new CustomInstrumentation(mInstrumentation, dexClassLoader);
53 | mInstrumentationField.set(currentActivityThread, pluginInstrumentation);
54 | }
55 | } catch (Exception e) {
56 | e.printStackTrace();
57 | }
58 | }
59 |
60 | }
61 |
--------------------------------------------------------------------------------
/5-ResModificationPlugin/host/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
12 |
13 |
17 |
18 |
22 |
23 |
--------------------------------------------------------------------------------
/5-ResModificationPlugin/host/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2BAB/Android-Dynamic-Loading-Notes/dc6cd3e7aae2c9b5332ce743f247ef194b35f90f/5-ResModificationPlugin/host/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/5-ResModificationPlugin/host/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2BAB/Android-Dynamic-Loading-Notes/dc6cd3e7aae2c9b5332ce743f247ef194b35f90f/5-ResModificationPlugin/host/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/5-ResModificationPlugin/host/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2BAB/Android-Dynamic-Loading-Notes/dc6cd3e7aae2c9b5332ce743f247ef194b35f90f/5-ResModificationPlugin/host/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/5-ResModificationPlugin/host/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2BAB/Android-Dynamic-Loading-Notes/dc6cd3e7aae2c9b5332ce743f247ef194b35f90f/5-ResModificationPlugin/host/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/5-ResModificationPlugin/host/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2BAB/Android-Dynamic-Loading-Notes/dc6cd3e7aae2c9b5332ce743f247ef194b35f90f/5-ResModificationPlugin/host/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/5-ResModificationPlugin/host/app/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/5-ResModificationPlugin/host/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 | #FFFFE0
7 |
8 |
--------------------------------------------------------------------------------
/5-ResModificationPlugin/host/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 |
6 |
--------------------------------------------------------------------------------
/5-ResModificationPlugin/host/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | ResModification
3 | ResModification
4 |
5 |
--------------------------------------------------------------------------------
/5-ResModificationPlugin/host/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/5-ResModificationPlugin/host/app/src/test/java/com/example/resmodification/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.example.resmodification;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() throws Exception {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/5-ResModificationPlugin/host/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | repositories {
5 | jcenter()
6 | }
7 | dependencies {
8 | classpath 'com.android.tools.build:gradle:2.2.2'
9 |
10 | // NOTE: Do not place your application dependencies here; they belong
11 | // in the individual module build.gradle files
12 | }
13 | }
14 |
15 | allprojects {
16 | repositories {
17 | jcenter()
18 | }
19 | }
20 |
21 | task clean(type: Delete) {
22 | delete rootProject.buildDir
23 | }
24 |
--------------------------------------------------------------------------------
/5-ResModificationPlugin/host/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | org.gradle.jvmargs=-Xmx1536m
13 |
14 | # When configured, Gradle will run in incubating parallel mode.
15 | # This option should only be used with decoupled projects. More details, visit
16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
17 | # org.gradle.parallel=true
18 |
--------------------------------------------------------------------------------
/5-ResModificationPlugin/host/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2BAB/Android-Dynamic-Loading-Notes/dc6cd3e7aae2c9b5332ce743f247ef194b35f90f/5-ResModificationPlugin/host/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/5-ResModificationPlugin/host/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Mon Dec 28 10:00:20 PST 2015
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
7 |
--------------------------------------------------------------------------------
/5-ResModificationPlugin/host/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------
/5-ResModificationPlugin/plugin/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/
5 | .DS_Store
6 | /build
7 | /captures
8 | .externalNativeBuild
--------------------------------------------------------------------------------
/5-ResModificationPlugin/plugin/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/5-ResModificationPlugin/plugin/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 | apply plugin: 'res-modification'
3 | android {
4 | compileSdkVersion 24
5 | buildToolsVersion "24.0.3"
6 | defaultConfig {
7 | applicationId "com.example.plugin5"
8 | minSdkVersion 21
9 | targetSdkVersion 24
10 | versionCode 1
11 | versionName "1.0"
12 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
13 | }
14 | buildTypes {
15 | release {
16 | minifyEnabled false
17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18 | }
19 | }
20 | }
21 |
22 | dependencies {
23 | compile fileTree(dir: 'libs', include: ['*.jar'])
24 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
25 | exclude group: 'com.android.support', module: 'support-annotations'
26 | })
27 | compile 'com.android.support:appcompat-v7:24.2.1'
28 | testCompile 'junit:junit:4.12'
29 | }
30 |
--------------------------------------------------------------------------------
/5-ResModificationPlugin/plugin/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /Users/2bab/Dependence/sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/5-ResModificationPlugin/plugin/app/src/androidTest/java/com/example/plugin5/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.example.plugin5;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumentation test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() throws Exception {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("com.example.plugin5", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/5-ResModificationPlugin/plugin/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/5-ResModificationPlugin/plugin/app/src/main/res/layout/plugin_activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
15 |
16 |
--------------------------------------------------------------------------------
/5-ResModificationPlugin/plugin/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2BAB/Android-Dynamic-Loading-Notes/dc6cd3e7aae2c9b5332ce743f247ef194b35f90f/5-ResModificationPlugin/plugin/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/5-ResModificationPlugin/plugin/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2BAB/Android-Dynamic-Loading-Notes/dc6cd3e7aae2c9b5332ce743f247ef194b35f90f/5-ResModificationPlugin/plugin/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/5-ResModificationPlugin/plugin/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2BAB/Android-Dynamic-Loading-Notes/dc6cd3e7aae2c9b5332ce743f247ef194b35f90f/5-ResModificationPlugin/plugin/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/5-ResModificationPlugin/plugin/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2BAB/Android-Dynamic-Loading-Notes/dc6cd3e7aae2c9b5332ce743f247ef194b35f90f/5-ResModificationPlugin/plugin/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/5-ResModificationPlugin/plugin/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2BAB/Android-Dynamic-Loading-Notes/dc6cd3e7aae2c9b5332ce743f247ef194b35f90f/5-ResModificationPlugin/plugin/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/5-ResModificationPlugin/plugin/app/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/5-ResModificationPlugin/plugin/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 | #FF1111
7 |
8 |
--------------------------------------------------------------------------------
/5-ResModificationPlugin/plugin/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 |
6 |
--------------------------------------------------------------------------------
/5-ResModificationPlugin/plugin/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Plugin5
3 |
4 |
--------------------------------------------------------------------------------
/5-ResModificationPlugin/plugin/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/5-ResModificationPlugin/plugin/app/src/test/java/com/example/plugin5/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.example.plugin5;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() throws Exception {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/5-ResModificationPlugin/plugin/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | repositories {
5 | mavenLocal()
6 | jcenter()
7 | }
8 | dependencies {
9 | classpath 'com.android.tools.build:gradle:2.2.2'
10 | classpath 'com.example.gradle:res-modification-plugin:1.0.1-SNAPSHOT'
11 | // NOTE: Do not place your application dependencies here; they belong
12 | // in the individual module build.gradle files
13 | }
14 | }
15 |
16 | allprojects {
17 | repositories {
18 | jcenter()
19 | }
20 | }
21 |
22 | task clean(type: Delete) {
23 | delete rootProject.buildDir
24 | }
25 |
26 |
--------------------------------------------------------------------------------
/5-ResModificationPlugin/plugin/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | org.gradle.jvmargs=-Xmx1536m
13 |
14 | # When configured, Gradle will run in incubating parallel mode.
15 | # This option should only be used with decoupled projects. More details, visit
16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
17 | # org.gradle.parallel=true
18 |
--------------------------------------------------------------------------------
/5-ResModificationPlugin/plugin/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2BAB/Android-Dynamic-Loading-Notes/dc6cd3e7aae2c9b5332ce743f247ef194b35f90f/5-ResModificationPlugin/plugin/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/5-ResModificationPlugin/plugin/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Mon Dec 28 10:00:20 PST 2015
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
7 |
--------------------------------------------------------------------------------
/5-ResModificationPlugin/plugin/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------
/5-ResModificationPlugin/res-modification-plugin/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 |
--------------------------------------------------------------------------------
/5-ResModificationPlugin/res-modification-plugin/README.md:
--------------------------------------------------------------------------------
1 | # SampleGradlePlugin
2 |
3 | This Project is used for [initPlugin.sh](https://gist.github.com/2BAB/f8a247b1be2ffad2ad924d78ca1e34b9), which is A Script For Init Gradle Plugin Project.
4 |
--------------------------------------------------------------------------------
/5-ResModificationPlugin/res-modification-plugin/build.gradle:
--------------------------------------------------------------------------------
1 | group 'com.example.gradle'
2 | version '1.0.1-SNAPSHOT'
3 |
4 | apply plugin: 'java'
5 | apply plugin: 'groovy'
6 | apply plugin: 'maven-publish'
7 |
8 | repositories {
9 | jcenter()
10 | mavenCentral()
11 | mavenLocal()
12 | }
13 |
14 | dependencies {
15 | compile gradleApi()
16 | compile localGroovy()
17 | compile 'com.android.tools.build:gradle:2.2.2'
18 | }
19 |
20 | publishing {
21 | publications {
22 | mavenJava(MavenPublication) {
23 | from components.java
24 | pom.withXml {
25 | asNode().dependencies.'*'.findAll() {
26 | it.scope.text() == 'runtime' && project.configurations.compile.allDependencies.find { dep ->
27 | dep.name == it.artifactId.text()
28 | }
29 | }.each() {
30 | it.scope*.value = 'compile'
31 | }
32 | }
33 | }
34 | }
35 | }
36 |
37 | publishing {
38 | repositories {
39 | mavenLocal()
40 | }
41 | }
--------------------------------------------------------------------------------
/5-ResModificationPlugin/res-modification-plugin/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2BAB/Android-Dynamic-Loading-Notes/dc6cd3e7aae2c9b5332ce743f247ef194b35f90f/5-ResModificationPlugin/res-modification-plugin/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/5-ResModificationPlugin/res-modification-plugin/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Mon Dec 28 10:00:20 PST 2015
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
7 |
--------------------------------------------------------------------------------
/5-ResModificationPlugin/res-modification-plugin/settings.gradle:
--------------------------------------------------------------------------------
1 | rootProject.name = 'res-modification-plugin'
2 |
--------------------------------------------------------------------------------
/5-ResModificationPlugin/res-modification-plugin/src/main/groovy/com/example/gradle/aapt/ResStringFlag.groovy:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015-present wequick.net
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
5 | * not use this file except in compliance with the License. You may obtain
6 | * a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations
14 | * under the License.
15 | */
16 | package com.example.gradle.aapt
17 |
18 | /**
19 | * enum from include/androidfw/ResourceTypes.h
20 | */
21 | public enum ResStringFlag {
22 | public static int SORTED_FLAG = 1<<0;
23 | public static int UTF8_FLAG = 1<<8;
24 | }
25 |
--------------------------------------------------------------------------------
/5-ResModificationPlugin/res-modification-plugin/src/main/groovy/com/example/gradle/aapt/ResStringPoolSpan.groovy:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015-present wequick.net
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
5 | * not use this file except in compliance with the License. You may obtain
6 | * a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations
14 | * under the License.
15 | */
16 | package com.example.gradle.aapt
17 |
18 | /**
19 | * enum from include/androidfw/ResourceTypes.h
20 | */
21 | public enum ResStringPoolSpan {
22 | public static int END = 0xFFFFFFFF;
23 | public static byte[] END_SPAN = [0xFF, 0xFF, 0xFF, 0xFF,
24 | 0xFF, 0xFF, 0xFF, 0xFF]
25 | }
--------------------------------------------------------------------------------
/5-ResModificationPlugin/res-modification-plugin/src/main/groovy/com/example/gradle/aapt/ResTableEntry.groovy:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015-present wequick.net
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
5 | * not use this file except in compliance with the License. You may obtain
6 | * a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations
14 | * under the License.
15 | */
16 | package com.example.gradle.aapt
17 |
18 | /**
19 | * enum from include/androidfw/ResourceTypes.h
20 | */
21 | public enum ResTableEntry {
22 | public static int FLAG_COMPLEX = 0X0001;
23 | public static int FLAG_PUBLIC = 0X0002;
24 | public static int FLAG_WEAK = 0X0004;
25 | }
26 |
--------------------------------------------------------------------------------
/5-ResModificationPlugin/res-modification-plugin/src/main/groovy/com/example/gradle/aapt/ResTableType.groovy:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015-present wequick.net
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
5 | * not use this file except in compliance with the License. You may obtain
6 | * a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations
14 | * under the License.
15 | */
16 | package com.example.gradle.aapt
17 |
18 | /**
19 | * enum from include/androidfw/ResourceTypes.h
20 | */
21 | public enum ResTableType {
22 | public static int NO_ENTRY = -1;
23 | }
24 |
--------------------------------------------------------------------------------
/5-ResModificationPlugin/res-modification-plugin/src/main/groovy/com/example/gradle/aapt/ResType.groovy:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015-present wequick.net
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
5 | * not use this file except in compliance with the License. You may obtain
6 | * a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations
14 | * under the License.
15 | */
16 | package com.example.gradle.aapt
17 |
18 | /**
19 | * enum from include/androidfw/ResourceTypes.h
20 | */
21 | public enum ResType {
22 | public static int RES_NULL_TYPE = 0x0000;
23 | public static int RES_STRING_POOL_TYPE = 0x0001;
24 | public static int RES_TABLE_TYPE = 0x0002;
25 | public static int RES_XML_TYPE = 0x0003;
26 |
27 | // Chunk types in RES_XML_TYPE
28 | public static int RES_XML_FIRST_CHUNK_TYPE = 0x0100;
29 | public static int RES_XML_START_NAMESPACE_TYPE = 0x0100;
30 | public static int RES_XML_END_NAMESPACE_TYPE = 0x0101;
31 | public static int RES_XML_START_ELEMENT_TYPE = 0x0102;
32 | public static int RES_XML_END_ELEMENT_TYPE = 0x0103;
33 | public static int RES_XML_CDATA_TYPE = 0x0104;
34 | public static int RES_XML_LAST_CHUNK_TYPE = 0x017;
35 | // This contains a uint32_t array mapping strings in the string
36 | // pool back to resource identifiers. It is optional.
37 | public static int RES_XML_RESOURCE_MAP_TYPE = 0x0180;
38 |
39 | // Chunk types in RES_TABLE_TYPE
40 | public static int RES_TABLE_PACKAGE_TYPE = 0x0200;
41 | public static int RES_TABLE_TYPE_TYPE = 0x0201;
42 | public static int RES_TABLE_TYPE_SPEC_TYPE = 0x0202;
43 | public static int RES_TABLE_LIBRARY_TYPE = 0x0203;
44 | }
45 |
--------------------------------------------------------------------------------
/5-ResModificationPlugin/res-modification-plugin/src/main/groovy/com/example/gradle/aapt/ResValueDataType.groovy:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015-present wequick.net
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
5 | * not use this file except in compliance with the License. You may obtain
6 | * a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations
14 | * under the License.
15 | */
16 | package com.example.gradle.aapt
17 |
18 | /**
19 | * enum from include/androidfw/ResourceTypes.h
20 | */
21 | public enum ResValueDataType {
22 | public static int TYPE_REFERENCE = 0x01;
23 | public static int TYPE_STRING = 0x03;
24 | }
25 |
--------------------------------------------------------------------------------
/5-ResModificationPlugin/res-modification-plugin/src/main/resources/META-INF/gradle-plugins/res-modification.properties:
--------------------------------------------------------------------------------
1 | implementation-class=com.example.gradle.PluginImpl
2 |
--------------------------------------------------------------------------------
/6-StartPluginService/host/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/workspace.xml
5 | /.idea/libraries
6 | .DS_Store
7 | /build
8 | /captures
9 | .externalNativeBuild
10 |
--------------------------------------------------------------------------------
/6-StartPluginService/host/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/6-StartPluginService/host/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 25
5 | buildToolsVersion "25.0.2"
6 | defaultConfig {
7 | applicationId "com.example.startserviceplugin"
8 | minSdkVersion 19
9 | targetSdkVersion 25
10 | versionCode 1
11 | versionName "1.0"
12 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
13 | }
14 | buildTypes {
15 | release {
16 | minifyEnabled false
17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18 | }
19 | }
20 | }
21 |
22 | dependencies {
23 | compile fileTree(dir: 'libs', include: ['*.jar'])
24 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
25 | exclude group: 'com.android.support', module: 'support-annotations'
26 | })
27 | compile 'com.android.support:appcompat-v7:25.1.0'
28 | compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha9'
29 | testCompile 'junit:junit:4.12'
30 | }
31 |
--------------------------------------------------------------------------------
/6-StartPluginService/host/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /Users/2bab/Dependence/sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
19 | # Uncomment this to preserve the line number information for
20 | # debugging stack traces.
21 | #-keepattributes SourceFile,LineNumberTable
22 |
23 | # If you keep the line number information, uncomment this to
24 | # hide the original source file name.
25 | #-renamesourcefileattribute SourceFile
26 |
--------------------------------------------------------------------------------
/6-StartPluginService/host/app/src/androidTest/java/com/example/startserviceplugin/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.example.startserviceplugin;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumentation test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() throws Exception {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("com.example.startserviceplugin", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/6-StartPluginService/host/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/6-StartPluginService/host/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/6-StartPluginService/host/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2BAB/Android-Dynamic-Loading-Notes/dc6cd3e7aae2c9b5332ce743f247ef194b35f90f/6-StartPluginService/host/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/6-StartPluginService/host/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2BAB/Android-Dynamic-Loading-Notes/dc6cd3e7aae2c9b5332ce743f247ef194b35f90f/6-StartPluginService/host/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/6-StartPluginService/host/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2BAB/Android-Dynamic-Loading-Notes/dc6cd3e7aae2c9b5332ce743f247ef194b35f90f/6-StartPluginService/host/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/6-StartPluginService/host/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2BAB/Android-Dynamic-Loading-Notes/dc6cd3e7aae2c9b5332ce743f247ef194b35f90f/6-StartPluginService/host/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/6-StartPluginService/host/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2BAB/Android-Dynamic-Loading-Notes/dc6cd3e7aae2c9b5332ce743f247ef194b35f90f/6-StartPluginService/host/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/6-StartPluginService/host/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2BAB/Android-Dynamic-Loading-Notes/dc6cd3e7aae2c9b5332ce743f247ef194b35f90f/6-StartPluginService/host/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/6-StartPluginService/host/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2BAB/Android-Dynamic-Loading-Notes/dc6cd3e7aae2c9b5332ce743f247ef194b35f90f/6-StartPluginService/host/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/6-StartPluginService/host/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2BAB/Android-Dynamic-Loading-Notes/dc6cd3e7aae2c9b5332ce743f247ef194b35f90f/6-StartPluginService/host/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/6-StartPluginService/host/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2BAB/Android-Dynamic-Loading-Notes/dc6cd3e7aae2c9b5332ce743f247ef194b35f90f/6-StartPluginService/host/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/6-StartPluginService/host/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2BAB/Android-Dynamic-Loading-Notes/dc6cd3e7aae2c9b5332ce743f247ef194b35f90f/6-StartPluginService/host/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/6-StartPluginService/host/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/6-StartPluginService/host/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | StartServicePlugin
3 |
4 |
--------------------------------------------------------------------------------
/6-StartPluginService/host/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/6-StartPluginService/host/app/src/test/java/com/example/startserviceplugin/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.example.startserviceplugin;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() throws Exception {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/6-StartPluginService/host/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | repositories {
5 | jcenter()
6 | }
7 | dependencies {
8 | classpath 'com.android.tools.build:gradle:2.3.0'
9 |
10 | // NOTE: Do not place your application dependencies here; they belong
11 | // in the individual module build.gradle files
12 | }
13 | }
14 |
15 | allprojects {
16 | repositories {
17 | jcenter()
18 | }
19 | }
20 |
21 | task clean(type: Delete) {
22 | delete rootProject.buildDir
23 | }
24 |
--------------------------------------------------------------------------------
/6-StartPluginService/host/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | org.gradle.jvmargs=-Xmx1536m
13 |
14 | # When configured, Gradle will run in incubating parallel mode.
15 | # This option should only be used with decoupled projects. More details, visit
16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
17 | # org.gradle.parallel=true
18 |
--------------------------------------------------------------------------------
/6-StartPluginService/host/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2BAB/Android-Dynamic-Loading-Notes/dc6cd3e7aae2c9b5332ce743f247ef194b35f90f/6-StartPluginService/host/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/6-StartPluginService/host/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Mon Mar 13 19:45:50 CST 2017
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
7 |
--------------------------------------------------------------------------------
/6-StartPluginService/host/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------
/6-StartPluginService/plugin/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/workspace.xml
5 | /.idea/libraries
6 | .DS_Store
7 | /build
8 | /captures
9 | .externalNativeBuild
10 |
--------------------------------------------------------------------------------
/6-StartPluginService/plugin/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/6-StartPluginService/plugin/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 25
5 | buildToolsVersion "25.0.2"
6 | defaultConfig {
7 | applicationId "com.example.plugin6"
8 | minSdkVersion 19
9 | targetSdkVersion 25
10 | versionCode 1
11 | versionName "1.0"
12 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
13 | }
14 | buildTypes {
15 | release {
16 | minifyEnabled false
17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18 | }
19 | }
20 | }
21 |
22 | dependencies {
23 | compile fileTree(dir: 'libs', include: ['*.jar'])
24 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
25 | exclude group: 'com.android.support', module: 'support-annotations'
26 | })
27 | compile 'com.android.support:appcompat-v7:25.1.0'
28 | compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha9'
29 | testCompile 'junit:junit:4.12'
30 | }
31 |
--------------------------------------------------------------------------------
/6-StartPluginService/plugin/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /Users/2bab/Dependence/sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
19 | # Uncomment this to preserve the line number information for
20 | # debugging stack traces.
21 | #-keepattributes SourceFile,LineNumberTable
22 |
23 | # If you keep the line number information, uncomment this to
24 | # hide the original source file name.
25 | #-renamesourcefileattribute SourceFile
26 |
--------------------------------------------------------------------------------
/6-StartPluginService/plugin/app/src/androidTest/java/com/example/plugin6/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.example.plugin6;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumentation test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() throws Exception {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("com.example.plugin6", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/6-StartPluginService/plugin/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/6-StartPluginService/plugin/app/src/main/java/com/example/plugin6/PluginActivity.java:
--------------------------------------------------------------------------------
1 | package com.example.plugin6;
2 |
3 | import android.graphics.Color;
4 | import android.os.Bundle;
5 | import android.support.v7.app.AppCompatActivity;
6 | import android.widget.Button;
7 | import android.widget.RelativeLayout;
8 |
9 | public class PluginActivity extends AppCompatActivity {
10 |
11 | @Override
12 | protected void onCreate(Bundle savedInstanceState) {
13 | super.onCreate(savedInstanceState);
14 | RelativeLayout root = new RelativeLayout(this);
15 | root.setBackgroundColor(Color.BLUE);
16 | Button button = new Button(this);
17 | button.setText("I'm Plugin Activity");
18 | root.addView(button);
19 | setContentView(root);
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/6-StartPluginService/plugin/app/src/main/java/com/example/plugin6/PluginService.java:
--------------------------------------------------------------------------------
1 | package com.example.plugin6;
2 |
3 | import android.app.Service;
4 | import android.content.Intent;
5 | import android.os.Handler;
6 | import android.os.HandlerThread;
7 | import android.os.IBinder;
8 | import android.os.Message;
9 | import android.os.Messenger;
10 | import android.os.RemoteException;
11 |
12 | /**
13 | * Created by 2bab on 2017/3/13.
14 | */
15 |
16 | public class PluginService extends Service {
17 |
18 | private static final int GET_MSG_ACTIVITY_MESSENGER = 0x2330;
19 | private static final int SEND_NORMAL_MSG_TO_ACTIVITY = 0x2333;
20 |
21 | // 该 Service 往 DisplayActivity 发消息的通道
22 | private Messenger activityMessenger;
23 | // DisplayActivity 往该 Service 发消息的通道
24 | private Messenger serviceMessenger;
25 |
26 | private HandlerThread handlerThread;
27 |
28 | @Override
29 | public void onCreate() {
30 | super.onCreate();
31 | handlerThread = new HandlerThread("PluginServiceHandlerThread");
32 | handlerThread.start();
33 |
34 | Handler handler = new Handler(handlerThread.getLooper()) {
35 | @Override
36 | public void handleMessage(Message msg) {
37 | if (msg.what == GET_MSG_ACTIVITY_MESSENGER) {
38 | if (activityMessenger == null) {
39 | // 双向链接建立完成
40 | activityMessenger = msg.replyTo;
41 |
42 | Message message = Message.obtain();
43 | message.what = SEND_NORMAL_MSG_TO_ACTIVITY;
44 | message.obj = "A Message from Plugin Service";
45 | try {
46 | activityMessenger.send(message);
47 | } catch (RemoteException e) {
48 | e.printStackTrace();
49 | }
50 | }
51 | }
52 | }
53 | };
54 |
55 | serviceMessenger = new Messenger(handler);
56 | }
57 |
58 | @Override
59 | public IBinder onBind(Intent intent) {
60 | return serviceMessenger.getBinder();
61 | }
62 |
63 |
64 | @Override
65 | public void onDestroy() {
66 | super.onDestroy();
67 | handlerThread.quitSafely();
68 | }
69 | }
70 |
--------------------------------------------------------------------------------
/6-StartPluginService/plugin/app/src/main/res/layout/activity_plugin.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/6-StartPluginService/plugin/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2BAB/Android-Dynamic-Loading-Notes/dc6cd3e7aae2c9b5332ce743f247ef194b35f90f/6-StartPluginService/plugin/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/6-StartPluginService/plugin/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2BAB/Android-Dynamic-Loading-Notes/dc6cd3e7aae2c9b5332ce743f247ef194b35f90f/6-StartPluginService/plugin/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/6-StartPluginService/plugin/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2BAB/Android-Dynamic-Loading-Notes/dc6cd3e7aae2c9b5332ce743f247ef194b35f90f/6-StartPluginService/plugin/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/6-StartPluginService/plugin/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2BAB/Android-Dynamic-Loading-Notes/dc6cd3e7aae2c9b5332ce743f247ef194b35f90f/6-StartPluginService/plugin/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/6-StartPluginService/plugin/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2BAB/Android-Dynamic-Loading-Notes/dc6cd3e7aae2c9b5332ce743f247ef194b35f90f/6-StartPluginService/plugin/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/6-StartPluginService/plugin/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2BAB/Android-Dynamic-Loading-Notes/dc6cd3e7aae2c9b5332ce743f247ef194b35f90f/6-StartPluginService/plugin/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/6-StartPluginService/plugin/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2BAB/Android-Dynamic-Loading-Notes/dc6cd3e7aae2c9b5332ce743f247ef194b35f90f/6-StartPluginService/plugin/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/6-StartPluginService/plugin/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2BAB/Android-Dynamic-Loading-Notes/dc6cd3e7aae2c9b5332ce743f247ef194b35f90f/6-StartPluginService/plugin/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/6-StartPluginService/plugin/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2BAB/Android-Dynamic-Loading-Notes/dc6cd3e7aae2c9b5332ce743f247ef194b35f90f/6-StartPluginService/plugin/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/6-StartPluginService/plugin/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2BAB/Android-Dynamic-Loading-Notes/dc6cd3e7aae2c9b5332ce743f247ef194b35f90f/6-StartPluginService/plugin/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/6-StartPluginService/plugin/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/6-StartPluginService/plugin/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | plugin6
3 |
4 |
--------------------------------------------------------------------------------
/6-StartPluginService/plugin/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/6-StartPluginService/plugin/app/src/test/java/com/example/plugin6/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.example.plugin6;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() throws Exception {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/6-StartPluginService/plugin/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | repositories {
5 | jcenter()
6 | }
7 | dependencies {
8 | classpath 'com.android.tools.build:gradle:2.3.0'
9 |
10 | // NOTE: Do not place your application dependencies here; they belong
11 | // in the individual module build.gradle files
12 | }
13 | }
14 |
15 | allprojects {
16 | repositories {
17 | jcenter()
18 | }
19 | }
20 |
21 | task clean(type: Delete) {
22 | delete rootProject.buildDir
23 | }
24 |
--------------------------------------------------------------------------------
/6-StartPluginService/plugin/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | org.gradle.jvmargs=-Xmx1536m
13 |
14 | # When configured, Gradle will run in incubating parallel mode.
15 | # This option should only be used with decoupled projects. More details, visit
16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
17 | # org.gradle.parallel=true
18 |
--------------------------------------------------------------------------------
/6-StartPluginService/plugin/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2BAB/Android-Dynamic-Loading-Notes/dc6cd3e7aae2c9b5332ce743f247ef194b35f90f/6-StartPluginService/plugin/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/6-StartPluginService/plugin/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Mon Mar 13 20:07:15 CST 2017
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=http\://mirrors.taobao.net/mirror/gradle/gradle-3.3-all.zip
7 |
--------------------------------------------------------------------------------
/6-StartPluginService/plugin/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------
/7-MultiClassloader/host/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/
5 | .DS_Store
6 | /build
7 | /captures
8 | .externalNativeBuild
9 |
--------------------------------------------------------------------------------
/7-MultiClassloader/host/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/7-MultiClassloader/host/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 25
5 | buildToolsVersion '25.0.2'
6 | defaultConfig {
7 | applicationId "com.example.multiClassloader"
8 | minSdkVersion 19
9 | targetSdkVersion 25
10 | versionCode 1
11 | versionName "1.0"
12 | }
13 | buildTypes {
14 | release {
15 | minifyEnabled false
16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
17 | }
18 | }
19 | }
20 |
21 | dependencies {
22 | compile fileTree(dir: 'libs', include: ['*.jar'])
23 | compile 'com.android.support:appcompat-v7:25.3.1'
24 | }
--------------------------------------------------------------------------------
/7-MultiClassloader/host/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /Users/2bab/Dependence/sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/7-MultiClassloader/host/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
9 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/7-MultiClassloader/host/app/src/main/java/com/example/multiclassloader/BundleClassloader.java:
--------------------------------------------------------------------------------
1 | package com.example.multiclassloader;
2 |
3 | import dalvik.system.DexClassLoader;
4 |
5 | /**
6 | * Created by 2bab on 2017/9/30.
7 | */
8 |
9 | public class BundleClassloader extends DexClassLoader {
10 |
11 | public BundleClassloader(String dexPath, String optimizedDirectory, String librarySearchPath, ClassLoader parent) {
12 | super(dexPath, optimizedDirectory, librarySearchPath, parent);
13 | }
14 |
15 | @Override
16 | public Class> findClass(String name) throws ClassNotFoundException {
17 | return super.findClass(name);
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/7-MultiClassloader/host/app/src/main/java/com/example/multiclassloader/DispatchClassloader.java:
--------------------------------------------------------------------------------
1 | package com.example.multiclassloader;
2 |
3 | import android.content.Context;
4 | import android.os.Environment;
5 |
6 | import java.io.File;
7 |
8 | /**
9 | * Created by 2bab on 2017/9/30.
10 | */
11 |
12 | public class DispatchClassloader extends ClassLoader {
13 |
14 | private BundleClassloader dexClassLoader;
15 | private Context context;
16 | private ClassLoader origin;
17 |
18 | public DispatchClassloader(ClassLoader origin, Context context) {
19 | super(origin.getParent());
20 | this.origin = origin;
21 | this.context = context;
22 | installDex();
23 | }
24 |
25 | private void installDex() {
26 | // 这里目前只装载了一个测试 Dex,正常情况下需要装载某个目录下的所有 dex 文件(通常每个 Bundle 有一个 Dex)
27 | File optimizedDexOutputPath = new File(
28 | Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS) + "/7-MultiClassloader.dex");
29 | File dexOutputDir = context.getDir("dex", 0);
30 | dexClassLoader = new BundleClassloader(
31 | optimizedDexOutputPath.getAbsolutePath(),
32 | dexOutputDir.getAbsolutePath(),
33 | null,
34 | origin);
35 | }
36 |
37 | @Override
38 | protected Class> findClass(String name) throws ClassNotFoundException {
39 | // 需要在这里遍历所有 Bundle 的 Classloader,或者用包名等来做查找分发
40 | Class> clz = dexClassLoader.findClass(name);
41 | return clz;
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/7-MultiClassloader/host/app/src/main/java/com/example/multiclassloader/LoadPluginClassTestInterface.java:
--------------------------------------------------------------------------------
1 | package com.example.multiclassloader;
2 |
3 | /**
4 | * Created by 2bab on 2016/11/15.
5 | */
6 |
7 | public interface LoadPluginClassTestInterface {
8 |
9 | float getPiValue();
10 |
11 | }
12 |
--------------------------------------------------------------------------------
/7-MultiClassloader/host/app/src/main/java/com/example/multiclassloader/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.example.multiclassloader;
2 |
3 | import android.os.Bundle;
4 | import android.support.v7.app.AppCompatActivity;
5 | import android.widget.Toast;
6 |
7 | public class MainActivity extends AppCompatActivity {
8 |
9 | @Override
10 | protected void onCreate(Bundle savedInstanceState) {
11 | super.onCreate(savedInstanceState);
12 | setContentView(R.layout.activity_main);
13 | loadPluginClassTest();
14 | }
15 |
16 | private void loadPluginClassTest() {
17 | try {
18 | Class libProviderClazz = Class.forName("com.example.multiclassloader.PluginClassWillBeLoad");
19 | System.out.println("PluginClassWillBeLoad getClassloader:" + libProviderClazz.getClassLoader());
20 | System.out.println("LoadPluginClassTestInterface getClassloader: " + LoadPluginClassTestInterface.class.getClassLoader());
21 | LoadPluginClassTestInterface dexInterface = (LoadPluginClassTestInterface) libProviderClazz.newInstance();
22 | Toast.makeText(this, dexInterface.getPiValue() + "", Toast.LENGTH_LONG).show();
23 | } catch (Exception e) {
24 | e.printStackTrace();
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/7-MultiClassloader/host/app/src/main/java/com/example/multiclassloader/MultiClassloaderApplication.java:
--------------------------------------------------------------------------------
1 | package com.example.multiclassloader;
2 |
3 | import android.app.Application;
4 | import android.content.Context;
5 |
6 | import java.lang.reflect.Field;
7 |
8 | /**
9 | * Created by 2bab on 2017/9/30.
10 | */
11 |
12 | public class MultiClassloaderApplication extends Application {
13 |
14 | @Override
15 | protected void attachBaseContext(Context base) {
16 | super.attachBaseContext(base);
17 | replacePathClassloaderParent(base);
18 | }
19 |
20 | @Override
21 | public void onCreate() {
22 | super.onCreate();
23 | }
24 |
25 | private void replacePathClassloaderParent(Context context) {
26 | ClassLoader pathClassloader = context.getClassLoader();
27 | DispatchClassloader dispatchClassloader = new DispatchClassloader(pathClassloader, context);
28 | final Class> clz = ClassLoader.class;
29 | try {
30 | final Field parentField = clz.getDeclaredField("parent");
31 | parentField.setAccessible(true);
32 | parentField.set(pathClassloader, dispatchClassloader);
33 | } catch (Exception e) {
34 | e.printStackTrace();
35 | }
36 | }
37 |
38 | }
39 |
--------------------------------------------------------------------------------
/7-MultiClassloader/host/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
12 |
13 |
17 |
18 |
--------------------------------------------------------------------------------
/7-MultiClassloader/host/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2BAB/Android-Dynamic-Loading-Notes/dc6cd3e7aae2c9b5332ce743f247ef194b35f90f/7-MultiClassloader/host/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/7-MultiClassloader/host/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2BAB/Android-Dynamic-Loading-Notes/dc6cd3e7aae2c9b5332ce743f247ef194b35f90f/7-MultiClassloader/host/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/7-MultiClassloader/host/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2BAB/Android-Dynamic-Loading-Notes/dc6cd3e7aae2c9b5332ce743f247ef194b35f90f/7-MultiClassloader/host/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/7-MultiClassloader/host/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2BAB/Android-Dynamic-Loading-Notes/dc6cd3e7aae2c9b5332ce743f247ef194b35f90f/7-MultiClassloader/host/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/7-MultiClassloader/host/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2BAB/Android-Dynamic-Loading-Notes/dc6cd3e7aae2c9b5332ce743f247ef194b35f90f/7-MultiClassloader/host/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/7-MultiClassloader/host/app/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/7-MultiClassloader/host/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/7-MultiClassloader/host/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 |
6 |
--------------------------------------------------------------------------------
/7-MultiClassloader/host/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | MultiClassloader
3 |
4 |
--------------------------------------------------------------------------------
/7-MultiClassloader/host/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/7-MultiClassloader/host/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | repositories {
5 | jcenter()
6 | }
7 | dependencies {
8 | classpath 'com.android.tools.build:gradle:2.3.3'
9 |
10 | // NOTE: Do not place your application dependencies here; they belong
11 | // in the individual module build.gradle files
12 | }
13 | }
14 |
15 | allprojects {
16 | repositories {
17 | jcenter()
18 | }
19 | }
20 |
21 | task clean(type: Delete) {
22 | delete rootProject.buildDir
23 | }
24 |
--------------------------------------------------------------------------------
/7-MultiClassloader/host/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | org.gradle.jvmargs=-Xmx1536m
13 |
14 | # When configured, Gradle will run in incubating parallel mode.
15 | # This option should only be used with decoupled projects. More details, visit
16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
17 | # org.gradle.parallel=true
18 |
--------------------------------------------------------------------------------
/7-MultiClassloader/host/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2BAB/Android-Dynamic-Loading-Notes/dc6cd3e7aae2c9b5332ce743f247ef194b35f90f/7-MultiClassloader/host/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/7-MultiClassloader/host/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Sat Sep 30 12:03:44 CST 2017
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
7 |
--------------------------------------------------------------------------------
/7-MultiClassloader/host/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------
/7-MultiClassloader/plugin/src/com/example/multiclassloader/LoadPluginClassTestInterface.java:
--------------------------------------------------------------------------------
1 | package com.example.multiclassloader;
2 |
3 | /**
4 | * Created by 2bab on 2016/11/15.
5 | */
6 |
7 | public interface LoadPluginClassTestInterface {
8 |
9 | float getPiValue();
10 |
11 | }
12 |
--------------------------------------------------------------------------------
/7-MultiClassloader/plugin/src/com/example/multiclassloader/PluginClassWillBeLoad.java:
--------------------------------------------------------------------------------
1 | package com.example.multiclassloader;
2 |
3 | /**
4 | * Created by 2bab on 2016/11/15.
5 | */
6 |
7 | public class PluginClassWillBeLoad implements LoadPluginClassTestInterface{
8 |
9 | @Override
10 | public float getPiValue() {
11 | return 3.14f;
12 | }
13 |
14 | }
15 |
--------------------------------------------------------------------------------
/7-MultiClassloader/plugin/src/origin.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2BAB/Android-Dynamic-Loading-Notes/dc6cd3e7aae2c9b5332ce743f247ef194b35f90f/7-MultiClassloader/plugin/src/origin.jar
--------------------------------------------------------------------------------
/8-PackagePluginJavaCode/host/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/
5 | .DS_Store
6 | /build
7 | /captures
8 | .externalNativeBuild
9 |
--------------------------------------------------------------------------------
/8-PackagePluginJavaCode/host/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/8-PackagePluginJavaCode/host/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 25
5 | buildToolsVersion '25.0.2'
6 | defaultConfig {
7 | applicationId "com.example.multiClassloader8"
8 | minSdkVersion 19
9 | targetSdkVersion 25
10 | versionCode 1
11 | versionName "1.0"
12 | }
13 | buildTypes {
14 | release {
15 | minifyEnabled false
16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
17 | }
18 | }
19 | }
20 |
21 | dependencies {
22 | compile fileTree(dir: 'libs', include: ['*.jar'])
23 | compile 'com.android.support:appcompat-v7:25.3.1'
24 | }
--------------------------------------------------------------------------------
/8-PackagePluginJavaCode/host/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /Users/2bab/Dependence/sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/8-PackagePluginJavaCode/host/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
9 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/8-PackagePluginJavaCode/host/app/src/main/java/com/example/multiclassloader/BundleClassloader.java:
--------------------------------------------------------------------------------
1 | package com.example.multiclassloader;
2 |
3 | import dalvik.system.DexClassLoader;
4 |
5 | /**
6 | * Created by 2bab on 2017/9/30.
7 | */
8 |
9 | public class BundleClassloader extends DexClassLoader {
10 |
11 | public BundleClassloader(String dexPath, String optimizedDirectory, String librarySearchPath, ClassLoader parent) {
12 | super(dexPath, optimizedDirectory, librarySearchPath, parent);
13 | }
14 |
15 | @Override
16 | public Class> findClass(String name) throws ClassNotFoundException {
17 | return super.findClass(name);
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/8-PackagePluginJavaCode/host/app/src/main/java/com/example/multiclassloader/DispatchClassloader.java:
--------------------------------------------------------------------------------
1 | package com.example.multiclassloader;
2 |
3 | import android.content.Context;
4 | import android.os.Environment;
5 |
6 | import java.io.File;
7 |
8 | /**
9 | * Created by 2bab on 2017/9/30.
10 | */
11 |
12 | public class DispatchClassloader extends ClassLoader {
13 |
14 | private BundleClassloader dexClassLoader;
15 | private Context context;
16 | private ClassLoader origin;
17 |
18 | public DispatchClassloader(ClassLoader origin, Context context) {
19 | super(origin.getParent());
20 | this.origin = origin;
21 | this.context = context;
22 | installDex();
23 | }
24 |
25 | private void installDex() {
26 | // 这里目前只装载了一个测试 Dex,正常情况下需要装载某个目录下的所有 dex 文件(通常每个 Bundle 有一个 Dex)
27 | File optimizedDexOutputPath = new File(
28 | Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS) + "/7-MultiClassloader.apk");
29 | File dexOutputDir = context.getDir("dex", 0);
30 | dexClassLoader = new BundleClassloader(
31 | optimizedDexOutputPath.getAbsolutePath(),
32 | dexOutputDir.getAbsolutePath(),
33 | null,
34 | origin);
35 | }
36 |
37 | @Override
38 | protected Class> findClass(String name) throws ClassNotFoundException {
39 | // 需要在这里遍历所有 Bundle 的 Classloader,或者用包名等来做查找分发
40 | Class> clz = dexClassLoader.findClass(name);
41 | return clz;
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/8-PackagePluginJavaCode/host/app/src/main/java/com/example/multiclassloader/LoadPluginClassTestInterface.java:
--------------------------------------------------------------------------------
1 | package com.example.multiclassloader;
2 |
3 | /**
4 | * Created by 2bab on 2016/11/15.
5 | */
6 |
7 | public interface LoadPluginClassTestInterface {
8 |
9 | float getPiValue();
10 |
11 | }
12 |
--------------------------------------------------------------------------------
/8-PackagePluginJavaCode/host/app/src/main/java/com/example/multiclassloader/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.example.multiclassloader;
2 |
3 | import android.os.Bundle;
4 | import android.support.v7.app.AppCompatActivity;
5 | import android.widget.Toast;
6 |
7 | public class MainActivity extends AppCompatActivity {
8 |
9 | @Override
10 | protected void onCreate(Bundle savedInstanceState) {
11 | super.onCreate(savedInstanceState);
12 | setContentView(R.layout.activity_main);
13 | loadPluginClassTest();
14 | }
15 |
16 | private void loadPluginClassTest() {
17 | try {
18 | Class libProviderClazz = Class.forName("com.example.multiclassloader.PluginClassWillBeLoad");
19 | System.out.println("PluginClassWillBeLoad getClassloader:" + libProviderClazz.getClassLoader());
20 | System.out.println("LoadPluginClassTestInterface getClassloader: " + LoadPluginClassTestInterface.class.getClassLoader());
21 | LoadPluginClassTestInterface dexInterface = (LoadPluginClassTestInterface) libProviderClazz.newInstance();
22 | Toast.makeText(this, dexInterface.getPiValue() + "", Toast.LENGTH_LONG).show();
23 | } catch (Exception e) {
24 | e.printStackTrace();
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/8-PackagePluginJavaCode/host/app/src/main/java/com/example/multiclassloader/MultiClassloaderApplication.java:
--------------------------------------------------------------------------------
1 | package com.example.multiclassloader;
2 |
3 | import android.app.Application;
4 | import android.content.Context;
5 |
6 | import java.lang.reflect.Field;
7 |
8 | /**
9 | * Created by 2bab on 2017/9/30.
10 | */
11 |
12 | public class MultiClassloaderApplication extends Application {
13 |
14 | @Override
15 | protected void attachBaseContext(Context base) {
16 | super.attachBaseContext(base);
17 | replacePathClassloaderParent(base);
18 | }
19 |
20 | @Override
21 | public void onCreate() {
22 | super.onCreate();
23 | }
24 |
25 | private void replacePathClassloaderParent(Context context) {
26 | ClassLoader pathClassloader = context.getClassLoader();
27 | DispatchClassloader dispatchClassloader = new DispatchClassloader(pathClassloader, context);
28 | final Class> clz = ClassLoader.class;
29 | try {
30 | final Field parentField = clz.getDeclaredField("parent");
31 | parentField.setAccessible(true);
32 | parentField.set(pathClassloader, dispatchClassloader);
33 | } catch (Exception e) {
34 | e.printStackTrace();
35 | }
36 | }
37 |
38 | }
39 |
--------------------------------------------------------------------------------
/8-PackagePluginJavaCode/host/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
12 |
13 |
17 |
18 |
--------------------------------------------------------------------------------
/8-PackagePluginJavaCode/host/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2BAB/Android-Dynamic-Loading-Notes/dc6cd3e7aae2c9b5332ce743f247ef194b35f90f/8-PackagePluginJavaCode/host/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/8-PackagePluginJavaCode/host/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2BAB/Android-Dynamic-Loading-Notes/dc6cd3e7aae2c9b5332ce743f247ef194b35f90f/8-PackagePluginJavaCode/host/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/8-PackagePluginJavaCode/host/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2BAB/Android-Dynamic-Loading-Notes/dc6cd3e7aae2c9b5332ce743f247ef194b35f90f/8-PackagePluginJavaCode/host/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/8-PackagePluginJavaCode/host/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2BAB/Android-Dynamic-Loading-Notes/dc6cd3e7aae2c9b5332ce743f247ef194b35f90f/8-PackagePluginJavaCode/host/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/8-PackagePluginJavaCode/host/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2BAB/Android-Dynamic-Loading-Notes/dc6cd3e7aae2c9b5332ce743f247ef194b35f90f/8-PackagePluginJavaCode/host/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/8-PackagePluginJavaCode/host/app/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/8-PackagePluginJavaCode/host/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/8-PackagePluginJavaCode/host/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 |
6 |
--------------------------------------------------------------------------------
/8-PackagePluginJavaCode/host/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | MultiClassloader
3 |
4 |
--------------------------------------------------------------------------------
/8-PackagePluginJavaCode/host/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/8-PackagePluginJavaCode/host/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | repositories {
5 | jcenter()
6 | }
7 | dependencies {
8 | classpath 'com.android.tools.build:gradle:2.3.3'
9 |
10 | // NOTE: Do not place your application dependencies here; they belong
11 | // in the individual module build.gradle files
12 | }
13 | }
14 |
15 | allprojects {
16 | repositories {
17 | jcenter()
18 | }
19 | }
20 |
21 | task clean(type: Delete) {
22 | delete rootProject.buildDir
23 | }
24 |
--------------------------------------------------------------------------------
/8-PackagePluginJavaCode/host/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | org.gradle.jvmargs=-Xmx1536m
13 |
14 | # When configured, Gradle will run in incubating parallel mode.
15 | # This option should only be used with decoupled projects. More details, visit
16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
17 | # org.gradle.parallel=true
18 |
--------------------------------------------------------------------------------
/8-PackagePluginJavaCode/host/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2BAB/Android-Dynamic-Loading-Notes/dc6cd3e7aae2c9b5332ce743f247ef194b35f90f/8-PackagePluginJavaCode/host/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/8-PackagePluginJavaCode/host/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Sat Sep 30 12:03:44 CST 2017
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
7 |
--------------------------------------------------------------------------------
/8-PackagePluginJavaCode/host/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------
/8-PackagePluginJavaCode/pluginByApk/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/
5 | .DS_Store
6 | /build
7 | /captures
8 | .externalNativeBuild
9 |
--------------------------------------------------------------------------------
/8-PackagePluginJavaCode/pluginByApk/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/8-PackagePluginJavaCode/pluginByApk/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /Users/2bab/Dependence/sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/8-PackagePluginJavaCode/pluginByApk/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/8-PackagePluginJavaCode/pluginByApk/app/src/main/java/com/example/multiclassloader/LoadPluginClassTestInterface.java:
--------------------------------------------------------------------------------
1 | package com.example.multiclassloader;
2 |
3 | /**
4 | * Created by 2bab on 2016/11/15.
5 | */
6 |
7 | public interface LoadPluginClassTestInterface {
8 |
9 | float getPiValue();
10 |
11 | }
12 |
--------------------------------------------------------------------------------
/8-PackagePluginJavaCode/pluginByApk/app/src/main/java/com/example/multiclassloader/PluginActivity.java:
--------------------------------------------------------------------------------
1 | package com.example.multiclassloader;
2 |
3 | import android.support.v7.app.AppCompatActivity;
4 | import android.os.Bundle;
5 |
6 | public class PluginActivity extends AppCompatActivity {
7 |
8 | @Override
9 | protected void onCreate(Bundle savedInstanceState) {
10 | super.onCreate(savedInstanceState);
11 | setContentView(R.layout.activity_main);
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/8-PackagePluginJavaCode/pluginByApk/app/src/main/java/com/example/multiclassloader/PluginClassWillBeLoad.java:
--------------------------------------------------------------------------------
1 | package com.example.multiclassloader;
2 |
3 | /**
4 | * Created by 2bab on 2016/11/15.
5 | */
6 |
7 | public class PluginClassWillBeLoad implements LoadPluginClassTestInterface{
8 |
9 | @Override
10 | public float getPiValue() {
11 | return 3.14f;
12 | }
13 |
14 | }
15 |
--------------------------------------------------------------------------------
/8-PackagePluginJavaCode/pluginByApk/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
12 |
13 |
17 |
18 |
--------------------------------------------------------------------------------
/8-PackagePluginJavaCode/pluginByApk/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2BAB/Android-Dynamic-Loading-Notes/dc6cd3e7aae2c9b5332ce743f247ef194b35f90f/8-PackagePluginJavaCode/pluginByApk/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/8-PackagePluginJavaCode/pluginByApk/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2BAB/Android-Dynamic-Loading-Notes/dc6cd3e7aae2c9b5332ce743f247ef194b35f90f/8-PackagePluginJavaCode/pluginByApk/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/8-PackagePluginJavaCode/pluginByApk/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2BAB/Android-Dynamic-Loading-Notes/dc6cd3e7aae2c9b5332ce743f247ef194b35f90f/8-PackagePluginJavaCode/pluginByApk/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/8-PackagePluginJavaCode/pluginByApk/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2BAB/Android-Dynamic-Loading-Notes/dc6cd3e7aae2c9b5332ce743f247ef194b35f90f/8-PackagePluginJavaCode/pluginByApk/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/8-PackagePluginJavaCode/pluginByApk/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2BAB/Android-Dynamic-Loading-Notes/dc6cd3e7aae2c9b5332ce743f247ef194b35f90f/8-PackagePluginJavaCode/pluginByApk/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/8-PackagePluginJavaCode/pluginByApk/app/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/8-PackagePluginJavaCode/pluginByApk/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/8-PackagePluginJavaCode/pluginByApk/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 |
6 |
--------------------------------------------------------------------------------
/8-PackagePluginJavaCode/pluginByApk/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | LoadPluginClass
3 |
4 |
--------------------------------------------------------------------------------
/8-PackagePluginJavaCode/pluginByApk/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/8-PackagePluginJavaCode/pluginByApk/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | repositories {
5 | jcenter()
6 | }
7 | dependencies {
8 | classpath 'com.android.tools.build:gradle:2.3.3'
9 | classpath 'com.google.guava:guava:20.0'
10 | classpath 'commons-io:commons-io:1.4'
11 | classpath 'commons-codec:commons-codec:1.6'
12 | // NOTE: Do not place your application dependencies here; they belong
13 | // in the individual module build.gradle files
14 | }
15 | }
16 |
17 | allprojects {
18 | repositories {
19 | jcenter()
20 | }
21 | }
22 |
23 | task clean(type: Delete) {
24 | delete rootProject.buildDir
25 | }
26 |
--------------------------------------------------------------------------------
/8-PackagePluginJavaCode/pluginByApk/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | org.gradle.jvmargs=-Xmx1536m
13 |
14 | # When configured, Gradle will run in incubating parallel mode.
15 | # This option should only be used with decoupled projects. More details, visit
16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
17 | # org.gradle.parallel=true
18 |
--------------------------------------------------------------------------------
/8-PackagePluginJavaCode/pluginByApk/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2BAB/Android-Dynamic-Loading-Notes/dc6cd3e7aae2c9b5332ce743f247ef194b35f90f/8-PackagePluginJavaCode/pluginByApk/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/8-PackagePluginJavaCode/pluginByApk/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Sat Oct 07 10:32:32 CST 2017
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
7 |
--------------------------------------------------------------------------------
/8-PackagePluginJavaCode/pluginByApk/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Android-Plugin-Dev-Notes
2 | Samples & Notes for Plugin-Dev in Android.
3 |
--------------------------------------------------------------------------------