Gradle build fail for android_rpc demo

Hi, I’m trying to run gradle clean install in the app/android_rpc directory as shown in this android rpc demo but seeing the following error.

(tvm-build) emazuh@Emmanuels-MacBook-Pro-2 android_rpc % gradle clean build --stacktrace

> Configure project :app
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation'.
It will be removed at the end of 2018
WARNING: Configuration 'androidTestCompile' is obsolete and has been replaced with 'androidTestImplementation'.
It will be removed at the end of 2018
WARNING: Configuration 'androidTestApi' is obsolete and has been replaced with 'androidTestImplementation'.
It will be removed at the end of 2018
WARNING: Configuration 'testCompile' is obsolete and has been replaced with 'testImplementation'.
It will be removed at the end of 2018
WARNING: Configuration 'testApi' is obsolete and has been replaced with 'testImplementation'.
It will be removed at the end of 2018
WARNING: The specified Android SDK Build Tools version (26.0.1) is ignored, as it is below the minimum supported version (27.0.3) for Android Gradle Plugin 3.1.0.
Android SDK Build Tools 27.0.3 will be used.
To suppress this warning, remove "buildToolsVersion '26.0.1'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.

> Task :app:buildJni
make: Entering directory '/Users/emazuh/gitdir/tvm/apps/android_rpc/app/src/main/jni'
fcntl(): Bad file descriptor
Android NDK: WARNING: APP_PLATFORM android-24 is higher than android:minSdkVersion 1 in /Users/emazuh/gitdir/tvm/apps/android_rpc/app/src/main/AndroidManifest.xml. NDK binaries will *not* be compatible with devices older than android-24. See https://android.googlesource.com/platform/ndk/+/master/docs/user/common_problems.md for more information.    
Android NDK: WARNING:/Users/emazuh/gitdir/tvm/apps/android_rpc/app/src/main/jni/Android.mk:tvm4j_runtime_packed: non-system libraries in linker flags: -latomic    
Android NDK:     This is likely to result in incorrect builds. Try using LOCAL_STATIC_LIBRARIES    
Android NDK:     or LOCAL_SHARED_LIBRARIES instead to list the library dependencies of the    
Android NDK:     current module    
Android NDK: WARNING:/Users/emazuh/gitdir/tvm/apps/android_rpc/app/src/main/jni/Android.mk:tvm4j_runtime_packed: non-system libraries in linker flags: -latomic    
Android NDK:     This is likely to result in incorrect builds. Try using LOCAL_STATIC_LIBRARIES    
Android NDK:     or LOCAL_SHARED_LIBRARIES instead to list the library dependencies of the    
Android NDK:     current module    
Android NDK: WARNING:/Users/emazuh/gitdir/tvm/apps/android_rpc/app/src/main/jni/Android.mk:tvm4j_runtime_packed: non-system libraries in linker flags: -latomic    
Android NDK:     This is likely to result in incorrect builds. Try using LOCAL_STATIC_LIBRARIES    
Android NDK:     or LOCAL_SHARED_LIBRARIES instead to list the library dependencies of the    
Android NDK:     current module    
Android NDK: WARNING:/Users/emazuh/gitdir/tvm/apps/android_rpc/app/src/main/jni/Android.mk:tvm4j_runtime_packed: non-system libraries in linker flags: -latomic    
Android NDK:     This is likely to result in incorrect builds. Try using LOCAL_STATIC_LIBRARIES    
Android NDK:     or LOCAL_SHARED_LIBRARIES instead to list the library dependencies of the    
Android NDK:     current module    
make: Leaving directory '/Users/emazuh/gitdir/tvm/apps/android_rpc/app/src/main/jni'
make: Entering directory '/Users/emazuh/gitdir/tvm/apps/android_rpc/app/src/main/jni'
[arm64-v8a] Compile++      : tvm4j_runtime_packed <= org_apache_tvm_native_c_api.cc
[arm64-v8a] SharedLibrary  : libtvm4j_runtime_packed.so
[arm64-v8a] Install        : libtvm4j_runtime_packed.so => libs/arm64-v8a/libtvm4j_runtime_packed.so
[arm64-v8a] Install        : libc++_shared.so => libs/arm64-v8a/libc++_shared.so
[x86_64] Compile++      : tvm4j_runtime_packed <= org_apache_tvm_native_c_api.cc
[x86_64] SharedLibrary  : libtvm4j_runtime_packed.so
[x86_64] Install        : libtvm4j_runtime_packed.so => libs/x86_64/libtvm4j_runtime_packed.so
[x86_64] Install        : libc++_shared.so => libs/x86_64/libc++_shared.so
[armeabi-v7a] Compile++ arm  : tvm4j_runtime_packed <= org_apache_tvm_native_c_api.cc
[armeabi-v7a] SharedLibrary  : libtvm4j_runtime_packed.so
[armeabi-v7a] Install        : libtvm4j_runtime_packed.so => libs/armeabi-v7a/libtvm4j_runtime_packed.so
[armeabi-v7a] Install        : libc++_shared.so => libs/armeabi-v7a/libc++_shared.so
[x86] Compile++      : tvm4j_runtime_packed <= org_apache_tvm_native_c_api.cc
[x86] SharedLibrary  : libtvm4j_runtime_packed.so
[x86] Install        : libtvm4j_runtime_packed.so => libs/x86/libtvm4j_runtime_packed.so
[x86] Install        : libc++_shared.so => libs/x86/libc++_shared.so
make: Leaving directory '/Users/emazuh/gitdir/tvm/apps/android_rpc/app/src/main/jni'

> Task :app:compileDebugAidl FAILED

FAILURE: Build failed with an exception.

* What went wrong:
A problem was found with the configuration of task ':app:compileDebugAidl' (type 'AidlCompile').
  - In plugin 'com.android.build.gradle.api.AndroidBasePlugin' type 'com.android.build.gradle.tasks.AidlCompile' property 'importFolders' is private and annotated with @Internal.
    
    Reason: Annotations on private getters are ignored.
    
    Possible solutions:
      1. Make the getter public.
      2. Annotate the public version of the getter.
    
    Please refer to https://docs.gradle.org/7.1.1/userguide/validation_problems.html#private_getter_must_not_be_annotated for more details about this problem.

* Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Exception is:
org.gradle.internal.execution.WorkValidationException: A problem was found with the configuration of task ':app:compileDebugAidl' (type 'AidlCompile').
  - In plugin 'com.android.build.gradle.api.AndroidBasePlugin' type 'com.android.build.gradle.tasks.AidlCompile' property 'importFolders' is private and annotated with @Internal.
    
    Reason: Annotations on private getters are ignored.
    
    Possible solutions:
      1. Make the getter public.
      2. Annotate the public version of the getter.
    
    Please refer to https://docs.gradle.org/7.1.1/userguide/validation_problems.html#private_getter_must_not_be_annotated for more details about this problem.
        at org.gradle.internal.execution.WorkValidationException$BuilderWithSummary.build(WorkValidationException.java:109)
        at org.gradle.internal.execution.WorkValidationException$BuilderWithSummary.get(WorkValidationException.java:91)
        at org.gradle.internal.execution.steps.ValidateStep.execute(ValidateStep.java:98)
        at org.gradle.internal.execution.steps.ValidateStep.execute(ValidateStep.java:51)
        at org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep.execute(CaptureStateBeforeExecutionStep.java:72)
        at org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep.execute(CaptureStateBeforeExecutionStep.java:46)
        at org.gradle.internal.execution.steps.SkipEmptyWorkStep.lambda$execute$2(SkipEmptyWorkStep.java:86)
        at org.gradle.internal.execution.steps.SkipEmptyWorkStep.execute(SkipEmptyWorkStep.java:86)
        at org.gradle.internal.execution.steps.SkipEmptyWorkStep.execute(SkipEmptyWorkStep.java:32)
        at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsStartedStep.execute(MarkSnapshottingInputsStartedStep.java:38)
        at org.gradle.internal.execution.steps.LoadExecutionStateStep.execute(LoadExecutionStateStep.java:43)
        at org.gradle.internal.execution.steps.LoadExecutionStateStep.execute(LoadExecutionStateStep.java:31)
        at org.gradle.internal.execution.steps.AssignWorkspaceStep.lambda$execute$0(AssignWorkspaceStep.java:40)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$TaskExecution$2.withWorkspace(ExecuteActionsTaskExecuter.java:284)
        at org.gradle.internal.execution.steps.AssignWorkspaceStep.execute(AssignWorkspaceStep.java:40)
        at org.gradle.internal.execution.steps.AssignWorkspaceStep.execute(AssignWorkspaceStep.java:30)
        at org.gradle.internal.execution.steps.IdentityCacheStep.execute(IdentityCacheStep.java:37)
        at org.gradle.internal.execution.steps.IdentityCacheStep.execute(IdentityCacheStep.java:27)
        at org.gradle.internal.execution.steps.IdentifyStep.execute(IdentifyStep.java:44)
        at org.gradle.internal.execution.steps.IdentifyStep.execute(IdentifyStep.java:33)
        at org.gradle.internal.execution.impl.DefaultExecutionEngine$1.execute(DefaultExecutionEngine.java:76)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeIfValid(ExecuteActionsTaskExecuter.java:185)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:174)
        at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:109)
        at org.gradle.api.internal.tasks.execution.FinalizePropertiesTaskExecuter.execute(FinalizePropertiesTaskExecuter.java:46)
        at org.gradle.api.internal.tasks.execution.ResolveTaskExecutionModeExecuter.execute(ResolveTaskExecutionModeExecuter.java:51)
        at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:57)
        at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:56)
        at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:36)
        at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.executeTask(EventFiringTaskExecuter.java:77)
        at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:55)
        at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:52)
        at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:200)
        at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:195)
        at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:75)
        at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:68)
        at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:153)
        at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:68)
        at org.gradle.internal.operations.DefaultBuildOperationRunner.call(DefaultBuildOperationRunner.java:62)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.lambda$call$2(DefaultBuildOperationExecutor.java:79)
        at org.gradle.internal.operations.UnmanagedBuildOperationWrapper.callWithUnmanagedSupport(UnmanagedBuildOperationWrapper.java:54)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:79)
        at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:52)
        at org.gradle.execution.plan.LocalTaskNodeExecutor.execute(LocalTaskNodeExecutor.java:74)
        at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:408)
        at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:395)
        at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:388)
        at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:374)
        at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.lambda$run$0(DefaultPlanExecutor.java:127)
        at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.execute(DefaultPlanExecutor.java:191)
        at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.executeNextNode(DefaultPlanExecutor.java:182)
        at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.run(DefaultPlanExecutor.java:124)
        at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
        at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
        at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)


* Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

See https://docs.gradle.org/7.1.1/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 1m 43s
5 actionable tasks: 4 executed, 1 up-to-date

From what I’ve read so far, it seems the problem could be related to versions of gradle and android sdk I’m using so it could be that I don’t have the right combination. I currently have gradle version 7.1.1, NDK 22.1.7171670, java version “1.8.0_291” on Mac M1.

Using gradle 6 solved this.

Same issue here. Any plans to update the rpc repo to support latest gradle and jdk?

yeah I’ve just hit this issue…

Gladly I finally figure out an solution. After a grid search of possible jdk and ndk version, downgrading to jdk8 finally works for me.

Here is a pre-built rpc base on tvm v0.8.0 https://d2.lzhu.me/tvmrpc-release-0.8.0.apk. Let me know if you need a newer one.

1 Like

Great, I’ll try it. Even if it is built with v0.8, the RPC-related code hasn’t been updated a lot, so I think it is ok.

Would be good to get some help from community on this issue. @Lyken17 do you happen to know if it is some JDK system function needs upgrading?

cc relevant folks to tvm4j @yzhliu @csullivan

I rarely code with Java so I am not familiar with newer JDK features. But according to Android release cycle, newer OS usually requires higher JDK and in the future OpenJDK will be eventually depcrated.

The build error is mainly caused by that javah was replaced by Java -h. If we can get help from someone familar with gradle build, the fix should not be difficult. Meanwhile, I suggest to point out the required JDK version in the README.

1 Like