Reputation: 672
I am a new AOSP developer. I modified some files in AOSP and ran with target sdk_car_x86_64-userdebug, and then I made the framework using below command:
m framework -j32
m framework-minus-apex -j32
After the build was successful, I got the javalib.jar from path
~/path_to/aosp/out/target/product/emulator_car64_x86_64/obj/JAVA_LIBRARIES/framework-sdkextensions.com.android.sdkext_intermediates.
I created a simple Android application then put javalib.jar into app/libs then added the below line into the app/build.gradle
dependencies {
implementation(files("libs/javalib.jar"))
...
}
I run the emulator built from AOSP by command
source build/evnsetup.sh
lunch sdk_car_x86_64-userdebug
emulator
After the emulator started up successfully, I ran the application in it then I encountered an error
FATAL EXCEPTION: pool-2-thread-1
Process: com.example.myapp, PID: 2889
java.lang.IncompatibleClassChangeError: Class 'android.app.PendingIntent$$ExternalSyntheticLambda0' does not implement interface 'java.util.concurrent.Executor' in call to 'void java.util.concurrent.Executor.execute(java.lang.Runnable)' (declaration of 'androidx.profileinstaller.DeviceProfileWriter' appears in /data/app/~~ZGDppP5xMSrCMkinJtMDMQ==/com.example.myapp-asn8RdWTnUGeZXOezq_-iA==/base.apk!classes14.dex)
at androidx.profileinstaller.DeviceProfileWriter.result(DeviceProfileWriter.java:87)
at androidx.profileinstaller.DeviceProfileWriter.deviceAllowsProfileInstallerAotWrites(DeviceProfileWriter.java:140)
at androidx.profileinstaller.ProfileInstaller.transcodeAndWrite(ProfileInstaller.java:440)
at androidx.profileinstaller.ProfileInstaller.writeProfile(ProfileInstaller.java:575)
at androidx.profileinstaller.ProfileInstaller.writeProfile(ProfileInstaller.java:515)
at androidx.profileinstaller.ProfileInstaller.writeProfile(ProfileInstaller.java:479)
at androidx.profileinstaller.ProfileInstallerInitializer.lambda$writeInBackground$2(ProfileInstallerInitializer.java:145)
at androidx.profileinstaller.ProfileInstallerInitializer$$ExternalSyntheticLambda2.run(D8$$SyntheticClass:0)
I created another simple application then imported javalib.jar, I encountered another error
FATAL EXCEPTION: pool-2-thread-1
Process: com.example.dummyproject, PID: 3761
java.lang.NoSuchMethodError: No direct method <init>()V in class Landroid/app/PendingIntent$$ExternalSyntheticLambda0; or its super classes (declaration of 'android.app.PendingIntent$$ExternalSyntheticLambda0' appears in /system/framework/framework.jar)
at androidx.profileinstaller.ProfileInstaller.writeProfile(ProfileInstaller.java:479)
at androidx.profileinstaller.ProfileInstallerInitializer.lambda$writeInBackground$2(ProfileInstallerInitializer.java:145)
at androidx.profileinstaller.ProfileInstallerInitializer$$ExternalSyntheticLambda2.run(D8$$SyntheticClass:0)
How can I resolve this issue?
Upvotes: 0
Views: 152
Reputation: 1
I also faced this problem and I solved it by deleting the android/app folder in the framework.jar enter image description here
Upvotes: 0
Reputation: 1
I also encountered the same problem. You can refer to my build.gradle, but the cause of the problem is unknown.
gradle.projectsEvaluated {
tasks.withType(JavaCompile) {
if (options.bootstrapClasspath == null) return
Set<File> fileSet = options.bootstrapClasspath.getFiles()
List<File> newFileList = new ArrayList<>();
// JAVA语法,可连续调用,输入参数建议为相对路径
newFileList.add(new File("libs/framework-minus-apex.jar"))
// 最后将原始参数添加
newFileList.addAll(fileSet)
options.bootstrapClasspath = files(
newFileList.toArray()
)
}
}
dependencies {
implementation libs.appcompat
implementation libs.material
implementation libs.activity
implementation libs.constraintlayout
implementation libs.recyclerview
implementation libs.zxing.core
testImplementation libs.junit
androidTestImplementation libs.ext.junit
androidTestImplementation libs.espresso.core
// implementation files('libs/framework-minus-apex.jar')
implementation files('libs/mobiiot_factory_device.jar')
}
Upvotes: 0