interfaceITest { voidping(); intsum(int x, int y); }
2,用aidl工具生成java端接口实现
在aosp源码下载操作,然后第一步就生成错误了
1 2 3
~/code/aosp$ out/host/linux-x86/bin/aidl -oframeworks/native/cmds/bindergen/java/src/ frameworks/native/cmds/bindergen/ITest.aidl frameworks/native/cmds/bindergen/ITest.aidl:3 interface ITest should be declared in a file called demo/ITest.aidl. aidl E 1991 1991 aidl.cpp:545] Invalid package declaration 'demo'
$ cd binderdemo/java $ mm | tee [ 12% 1/8] target Prebuilt: java_binder_test (out/target/product/sailfish/obj/EXECUTABLES/java_binder_test_intermediates/java_binder_test) [ 25% 2/8] Install: out/target/product/sailfish/system/bin/java_binder_test [ 37% 3/8] Ensure Jack server is installed and started Jack server already installed in "/home/huangqw/.jack-server" Launching Jack server java -XX:MaxJavaStackTraceDepth=-1 -Djava.io.tmpdir=/tmp -Dfile.encoding=UTF-8 -XX:+TieredCompilation -cp /home/huangqw/.jack-server/launcher.jar com.android.jack.launcher.ServerLauncher [ 50% 4/8] Building with Jack: out/target/common/obj/JAVA_LIBRARIES/java_binder_test_intermediates/with-local/classes.dex [ 62% 5/8] Copying: out/target/common/obj/JAVA_LIBRARIES/java_binder_test_intermediates/classes.dex [ 75% 6/8] target Jar: java_binder_test (out/target/common/obj/JAVA_LIBRARIES/java_binder_test_intermediates/javalib.jar) [ 87% 7/8] build out/target/product/sailfish/obj/JAVA_LIBRARIES/java_binder_test_intermediates/javalib.jar [100% 8/8] Install: out/target/product/sailfish/system/framework/java_binder_test.jar