# Gradle build fail for android\_rpc demo

**URL:** <https://discuss.tvm.apache.org/t/gradle-build-fail-for-android-rpc-demo/10493>\
**Category:** Troubleshooting\
**Created:** [July 14, 2021, 6:03pm UTC](https://discuss.tvm.apache.org/t/gradle-build-fail-for-android-rpc-demo/10493 "2021-07-14T18:03:43Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![emma-mens](https://discuss.tvm.apache.org/user_avatar/discuss.tvm.apache.org/emma-mens/32/2598_2.png) [@emma-mens](https://discuss.tvm.apache.org/u/emma-mens)\
**Post date:** [July 14, 2021, 6:03pm UTC](https://discuss.tvm.apache.org/t/gradle-build-fail-for-android-rpc-demo/10493/1 "2021-07-14T18:03:43Z")

</div>

Hi, I’m trying to run `gradle clean install` in the `app/android_rpc` directory as shown in this android rpc [demo](https://github.com/apache/tvm/tree/main/apps/android_rpc) but seeing the following error.

```auto
(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.

---

<div class="post-metadata">

**Author:** ![emma-mens](https://discuss.tvm.apache.org/user_avatar/discuss.tvm.apache.org/emma-mens/32/2598_2.png) [@emma-mens](https://discuss.tvm.apache.org/u/emma-mens)\
**Post date:** [July 21, 2021, 9:05pm UTC](https://discuss.tvm.apache.org/t/gradle-build-fail-for-android-rpc-demo/10493/2 "2021-07-21T21:05:23Z")

</div>

Using gradle 6 solved this.

---

<div class="post-metadata">

**Author:** ![Lyken17](https://discuss.tvm.apache.org/user_avatar/discuss.tvm.apache.org/lyken17/32/711_2.png) [@Lyken17](https://discuss.tvm.apache.org/u/Lyken17)\
**Post date:** [November 30, 2021, 4:52am UTC](https://discuss.tvm.apache.org/t/gradle-build-fail-for-android-rpc-demo/10493/3 "2021-11-30T04:52:43Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![masahi](https://discuss.tvm.apache.org/user_avatar/discuss.tvm.apache.org/masahi/32/74_2.png) [@masahi](https://discuss.tvm.apache.org/u/masahi)\
**Post date:** [March 25, 2022, 12:31am UTC](https://discuss.tvm.apache.org/t/gradle-build-fail-for-android-rpc-demo/10493/4 "2022-03-25T00:31:39Z")

</div>

yeah I’ve just hit this issue…

---

<div class="post-metadata">

**Author:** ![Lyken17](https://discuss.tvm.apache.org/user_avatar/discuss.tvm.apache.org/lyken17/32/711_2.png) [@Lyken17](https://discuss.tvm.apache.org/u/Lyken17)\
**Post date:** [March 25, 2022, 1:04am UTC](https://discuss.tvm.apache.org/t/gradle-build-fail-for-android-rpc-demo/10493/5 "2022-03-25T01:04:24Z")

</div>

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

> [@Jvmpkg fails to build on mac osx](https://discuss.tvm.apache.org/t/jvmpkg-fails-to-build-on-mac-osx/11578/2):
>
> The issue might be caused by the javah was depcreated and removed in recent releases. The current workthrough I used is to degrade jdk to an older version. To fix this, the pom.xml files and related build shells needs to be changed via replacing javah with javac -h.

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

---

<div class="post-metadata">

**Author:** ![masahi](https://discuss.tvm.apache.org/user_avatar/discuss.tvm.apache.org/masahi/32/74_2.png) [@masahi](https://discuss.tvm.apache.org/u/masahi)\
**Post date:** [March 25, 2022, 4:40am UTC](https://discuss.tvm.apache.org/t/gradle-build-fail-for-android-rpc-demo/10493/6 "2022-03-25T04:40:24Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![tqchen](https://discuss.tvm.apache.org/user_avatar/discuss.tvm.apache.org/tqchen/32/5_2.png) [@tqchen](https://discuss.tvm.apache.org/u/tqchen)\
**Post date:** [March 29, 2022, 4:27pm UTC](https://discuss.tvm.apache.org/t/gradle-build-fail-for-android-rpc-demo/10493/7 "2022-03-29T16:27:33Z")

</div>

> [@emma-mens](#):
>
> ```auto
> 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
> 
> ```

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

---

<div class="post-metadata">

**Author:** ![Lyken17](https://discuss.tvm.apache.org/user_avatar/discuss.tvm.apache.org/lyken17/32/711_2.png) [@Lyken17](https://discuss.tvm.apache.org/u/Lyken17)\
**Post date:** [March 31, 2022, 8:20pm UTC](https://discuss.tvm.apache.org/t/gradle-build-fail-for-android-rpc-demo/10493/8 "2022-03-31T20:20:41Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![tqchen](https://discuss.tvm.apache.org/user_avatar/discuss.tvm.apache.org/tqchen/32/5_2.png) [@tqchen](https://discuss.tvm.apache.org/u/tqchen)\
**Post date:** [April 5, 2022, 1:00pm UTC](https://discuss.tvm.apache.org/t/gradle-build-fail-for-android-rpc-demo/10493/9 "2022-04-05T13:00:48Z")

</div>

> <https://github.com/apache/tvm/pull/10867>
>
> Update gradle configs to remove errors described in https://discuss.tvm.apache.o…rg/t/gradle-build-fail-for-android-rpc-demo/10493
> 
> Modified:
> \* https://github.com/apache/tvm/tree/main/apps/android\_camera
> \* https://github.com/apache/tvm/tree/main/apps/android\_deploy
> \* https://github.com/apache/tvm/tree/main/apps/android\_rpc
