๐ custom jar ํ์ผ์ ๋ง๋ค์ด์ ํ๋ก์ ํธ์ ์ถ๊ฐ
Android SDK ์ ํฌํจ๋์ง ์์ hidden api ๋ฅผ ์ฌ์ฉํ๋ ค๋ฉด custom jar ํ์ผ์ ๋ง๋ค์ด์ ํ๋ก์ ํธ์ ์ถ๊ฐํด์ฃผ๋ ๊ณผ์ ์ด ํ์ํ๋ค. ์ด ๊ณผ์ ์ ์๋ ๋ธ๋ก๊ทธ์ ์์ธํ ๋์์๋ค.
https://codechacha.com/ko/android-compile-with-custom-framework-jar/
์๋๋ก์ด๋ ์คํ๋์ค, custom framework.jar๋ก ๋น๋ํ๊ธฐ
Android Studio์์ custom framework.jar๋ฅผ importํ์ฌ hidden api ํธ์ถํ๋ ๋ฐฉ๋ฒ์ ๋ํด์ ์์๋ด ๋๋ค. ์ผ๋ฐ์ ์ผ๋ก ์ฑ์ ์๋๋ก์ด๋ SDK๋ฅผ ์ฌ์ฉํ์ฌ ๊ฐ๋ฐ๋ฉ๋๋ค. hidden api๋ฅผ ํธ์ถํ๋ ค๋ฉด reflection์ ์ฌ์ฉํ๊ฑฐ๋ c
codechacha.com
ํ์ง๋ง Android Studio 4.2 ์ด์์์ ์ ๋ธ๋ก๊ทธ์ ์๋ ๋ด์ฉ๋๋ก gradle ์ค์ ์ ํ๋ฉด
custom.jar ๋ณด๋ค Android SDK ๋ฅผ ๋จผ์ ์ฐธ์กฐํ๊ฒ ๋์ด hidden api ๋ฅผ ์ฌ์ฉํ ๋ถ๋ถ๋ค์์ 'cannot find symbol' ์๋ฌ๊ฐ ๋ฐ์ํ๊ฒ ๋๋ค. ๊ทธ๋์ ์๋์ ๊ฐ์ด gradle ์ค์ ์ ํด์ค์ผํ๋ค.
๐โ๏ธ Android Studio 4.2 ์ด์
gradle.projectsEvaluated {
tasks.withType(JavaCompile) {
if(options.bootstrapClasspath != null) {
Set<File> fileSet = options.bootstrapClasspath.getFiles()
List<File> newFileList = new ArrayList<>();
newFileList.add(new File("./app/extlib/frameworks.jar"))
newFileList.addAll(fileSet)
options.bootstrapClasspath = files(
newFileList.toArray()
)
}
}
}โ
๐โ๏ธ Android Studio 4.1 ์ดํ
gradle.projectsEvaluated {
tasks.withType(JavaCompile) {
options.compilerArgs.add('-Xbootclasspath/p:app/extlib/frameworks.jar')
}
}
[์ฐธ์กฐ]
https://chauyan.dev/2022/01/23/Import-Android-Framework-Jar
Import Android Framework Jar
Import AOSP framework jar fileWhy do we import the AOSP framework jar file to the Android Studio? It’s usually unnecessary to import this jar file to develop a standard application for your project.
chauyan.dev