Open algorist-mechanism opened 5 years ago
It appears, based on https://code.janeasystems.com/nodejs-mobile/faq#are-nodejs-native-modules-supported and https://github.com/janeasystems/nodejs-mobile/issues/121 native modules are only supported using nodejs-mobile-cordova and nodejs-mobile-native-react projects. I will try using cordova.
Install cordova 7 using
cordova using npm install corodova@7 -g
then followed the steps given in https://github.com/janeasystems/nodejs-mobile-samples/tree/master/cordova/UseNativeModules
This following steps fail:
cordova run android
ANDROID_HOME=/home/user/development/android-sdk-linux
JAVA_HOME=/usr/lib/jvm/java-8-oracle
Starting a Gradle Daemon (subsequent builds will be faster)
> Task :wrapper
BUILD SUCCESSFUL in 6s
1 actionable task: 1 executed
Subproject Path: CordovaLib
Starting a Gradle Daemon (subsequent builds will be faster)
The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use Task.doLast(Action) instead.
at build_61h4m30v1zeq015ppuchvi8dy.run(/home/user/git/janeasystems/nodejs-mobile-samples-one/cordova/UseNativeModules/platforms/android/build.gradle:142)
Support for CMake 3.7 and higher is a preview feature. To report a bug, see https://developer.android.com/studio/report-bugs.html
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'android'.
> No toolchains found in the NDK toolchains folder for ABI with prefix: mips64el-linux-android
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
* Get more help at https://help.gradle.org
BUILD FAILED in 11s
Error: /home/user/git/janeasystems/nodejs-mobile-samples-one/cordova/UseNativeModules/platforms/android/gradlew: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'android'.
> No toolchains found in the NDK toolchains folder for ABI with prefix: mips64el-linux-android
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
* Get more help at https://help.gradle.org
BUILD FAILED in 11s
Later versions of gradle do not try to build mips version based on https://github.com/google/filament/issues/15#issuecomment-412688220
To fix I updated the build tools gradle version to classpath 'com.android.tools.build:gradle:3.2.1' and buildToolsVersion "28.0.3" and gradle version 4.1 to 4.9 task wrapper(type: Wrapper) { gradleVersion = '4.9.0' } and updated cordova/UseNativeModules/platforms/android/gradle/wrapper/gradle-wrapper.properties and cordova/UseNativeModules/node_modules/cordova-android/framework/gradle/wrapper/gradle-wrapper.properties to use distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-all.zip
New error is that there is an old version of gradle, but the gradle distribution urls were edited. What can overwrite these and how do I update them? Updating the wrapper.properties again seems to work.
cordova run android
ANDROID_HOME=/home/user/development/android-sdk-linux
JAVA_HOME=/usr/lib/jvm/java-8-oracle
Subproject Path: CordovaLib
FAILURE: Build failed with an exception.
* Where:
Build file '/home/user/git/janeasystems/nodejs-mobile-samples-one/cordova/UseNativeModules/platforms/android/build.gradle' line: 20
* What went wrong:
A problem occurred evaluating root project 'android'.
> Failed to apply plugin [id 'com.android.application']
> Minimum supported Gradle version is 4.6. Current version is 4.1. If using the gradle wrapper, try editing the distributionUrl in /home/user/git/janeasystems/nodejs-mobile-samples-one/cordova/UseNativeModules/gradle/wrapper/gradle-wrapper.properties to gradle-4.6-all.zip
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
* Get more help at https://help.gradle.org
BUILD FAILED in 0s
Error: /home/user/git/janeasystems/nodejs-mobile-samples-one/cordova/UseNativeModules/platforms/android/gradlew: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.
* Where:
Build file '/home/user/git/janeasystems/nodejs-mobile-samples-one/cordova/UseNativeModules/platforms/android/build.gradle' line: 20
* What went wrong:
A problem occurred evaluating root project 'android'.
> Failed to apply plugin [id 'com.android.application']
> Minimum supported Gradle version is 4.6. Current version is 4.1. If using the gradle wrapper, try editing the distributionUrl in /home/user/git/janeasystems/nodejs-mobile-samples-one/cordova/UseNativeModules/gradle/wrapper/gradle-wrapper.properties to gradle-4.6-all.zip
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
* Get more help at https://help.gradle.org
BUILD FAILED in 0s
Task :BuildNpmModulesarmeabi-v7a fails with npm command. Here's the stacktrace. Not sure why it fails. npm is available in the PATH.
~/git/janeasystems/nodejs-mobile-samples-one/cordova/UseNativeModules/platforms/android$ ./gradlew assembleDebug --stacktrace
Starting a Gradle Daemon (subsequent builds will be faster)
> Configure project :CordovaLib
publishNonDefault is deprecated and has no effect anymore. All variants are now published.
> Task :MakeToolchainarmeabi-v7a
HOST_OS=linux
HOST_EXE=
HOST_ARCH=x86_64
HOST_TAG=linux-x86_64
HOST_NUM_CPUS=4
BUILD_NUM_CPUS=8
Toolchain installed to /home/user/git/janeasystems/nodejs-mobile-samples-one/cordova/UseNativeModules/platforms/android/build/standalone-toolchains/arm-linux-androideabi.
> Task :BuildNpmModulesarmeabi-v7a FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':BuildNpmModulesarmeabi-v7a'.
> A problem occurred starting process 'command 'npm''
* Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':BuildNpmModulesarmeabi-v7a'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:110)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:77)
at org.gradle.api.internal.tasks.execution.OutputDirectoryCreatingTaskExecuter.execute(OutputDirectoryCreatingTaskExecuter.java:51)
at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:59)
at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:59)
at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:101)
at org.gradle.api.internal.tasks.execution.FinalizeInputFilePropertiesTaskExecuter.execute(FinalizeInputFilePropertiesTaskExecuter.java:44)
at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:91)
at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:62)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:59)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.run(EventFiringTaskExecuter.java:51)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:300)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:292)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:174)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:46)
at org.gradle.execution.taskgraph.LocalTaskInfoExecutor.execute(LocalTaskInfoExecutor.java:42)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareWorkItemExecutor.execute(DefaultTaskExecutionGraph.java:273)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareWorkItemExecutor.execute(DefaultTaskExecutionGraph.java:258)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:135)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:130)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker.execute(DefaultTaskPlanExecutor.java:200)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker.executeWithWork(DefaultTaskPlanExecutor.java:191)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker.run(DefaultTaskPlanExecutor.java:130)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:74)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph.execute(DefaultTaskExecutionGraph.java:139)
at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:39)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:40)
at org.gradle.execution.DefaultBuildExecuter.access$000(DefaultBuildExecuter.java:24)
at org.gradle.execution.DefaultBuildExecuter$1.proceed(DefaultBuildExecuter.java:46)
at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:49)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:40)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:33)
at org.gradle.initialization.DefaultGradleLauncher$ExecuteTasks.run(DefaultGradleLauncher.java:347)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:300)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:292)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:174)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
at org.gradle.initialization.DefaultGradleLauncher.runTasks(DefaultGradleLauncher.java:216)
at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:146)
at org.gradle.initialization.DefaultGradleLauncher.executeTasks(DefaultGradleLauncher.java:121)
at org.gradle.internal.invocation.GradleBuildController$1.call(GradleBuildController.java:77)
at org.gradle.internal.invocation.GradleBuildController$1.call(GradleBuildController.java:74)
at org.gradle.internal.work.DefaultWorkerLeaseService.withLocks(DefaultWorkerLeaseService.java:152)
at org.gradle.internal.work.StopShieldingWorkerLeaseService.withLocks(StopShieldingWorkerLeaseService.java:38)
at org.gradle.internal.invocation.GradleBuildController.doBuild(GradleBuildController.java:96)
at org.gradle.internal.invocation.GradleBuildController.run(GradleBuildController.java:74)
at org.gradle.tooling.internal.provider.ExecuteBuildActionRunner.run(ExecuteBuildActionRunner.java:28)
at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
at org.gradle.tooling.internal.provider.ValidatingBuildActionRunner.run(ValidatingBuildActionRunner.java:32)
at org.gradle.launcher.exec.RunAsBuildOperationBuildActionRunner$3.run(RunAsBuildOperationBuildActionRunner.java:47)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:300)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:292)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:174)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
at org.gradle.launcher.exec.RunAsBuildOperationBuildActionRunner.run(RunAsBuildOperationBuildActionRunner.java:43)
at org.gradle.tooling.internal.provider.SubscribableBuildActionRunner.run(SubscribableBuildActionRunner.java:51)
at org.gradle.launcher.exec.InProcessBuildActionExecuter$1.transform(InProcessBuildActionExecuter.java:50)
at org.gradle.launcher.exec.InProcessBuildActionExecuter$1.transform(InProcessBuildActionExecuter.java:46)
at org.gradle.composite.internal.DefaultRootBuildState.run(DefaultRootBuildState.java:74)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:46)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:32)
at org.gradle.launcher.exec.BuildTreeScopeBuildActionExecuter.execute(BuildTreeScopeBuildActionExecuter.java:39)
at org.gradle.launcher.exec.BuildTreeScopeBuildActionExecuter.execute(BuildTreeScopeBuildActionExecuter.java:25)
at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:80)
at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:53)
at org.gradle.tooling.internal.provider.ServicesSetupBuildActionExecuter.execute(ServicesSetupBuildActionExecuter.java:62)
at org.gradle.tooling.internal.provider.ServicesSetupBuildActionExecuter.execute(ServicesSetupBuildActionExecuter.java:34)
at org.gradle.tooling.internal.provider.GradleThreadBuildActionExecuter.execute(GradleThreadBuildActionExecuter.java:36)
at org.gradle.tooling.internal.provider.GradleThreadBuildActionExecuter.execute(GradleThreadBuildActionExecuter.java:25)
at org.gradle.tooling.internal.provider.ParallelismConfigurationBuildActionExecuter.execute(ParallelismConfigurationBuildActionExecuter.java:43)
at org.gradle.tooling.internal.provider.ParallelismConfigurationBuildActionExecuter.execute(ParallelismConfigurationBuildActionExecuter.java:29)
at org.gradle.tooling.internal.provider.StartParamsValidatingActionExecuter.execute(StartParamsValidatingActionExecuter.java:59)
at org.gradle.tooling.internal.provider.StartParamsValidatingActionExecuter.execute(StartParamsValidatingActionExecuter.java:31)
at org.gradle.tooling.internal.provider.SessionFailureReportingActionExecuter.execute(SessionFailureReportingActionExecuter.java:59)
at org.gradle.tooling.internal.provider.SessionFailureReportingActionExecuter.execute(SessionFailureReportingActionExecuter.java:44)
at org.gradle.tooling.internal.provider.SetupLoggingActionExecuter.execute(SetupLoggingActionExecuter.java:46)
at org.gradle.tooling.internal.provider.SetupLoggingActionExecuter.execute(SetupLoggingActionExecuter.java:30)
at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:67)
at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:37)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:26)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:34)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:74)
at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:72)
at org.gradle.util.Swapper.swap(Swapper.java:38)
at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:72)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
at org.gradle.launcher.daemon.server.exec.LogAndCheckHealth.execute(LogAndCheckHealth.java:55)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:62)
at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:82)
at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:50)
at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:295)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
Caused by: org.gradle.process.internal.ExecException: A problem occurred starting process 'command 'npm''
at org.gradle.process.internal.DefaultExecHandle.execExceptionFor(DefaultExecHandle.java:231)
at org.gradle.process.internal.DefaultExecHandle.setEndStateInfo(DefaultExecHandle.java:209)
at org.gradle.process.internal.DefaultExecHandle.failed(DefaultExecHandle.java:355)
at org.gradle.process.internal.ExecHandleRunner.run(ExecHandleRunner.java:85)
at org.gradle.internal.operations.CurrentBuildOperationPreservingRunnable.run(CurrentBuildOperationPreservingRunnable.java:42)
... 3 more
Caused by: net.rubygrapefruit.platform.NativeException: Could not start 'npm'
at net.rubygrapefruit.platform.internal.DefaultProcessLauncher.start(DefaultProcessLauncher.java:27)
at net.rubygrapefruit.platform.internal.WrapperProcessLauncher.start(WrapperProcessLauncher.java:36)
at org.gradle.process.internal.ExecHandleRunner.run(ExecHandleRunner.java:67)
... 4 more
Caused by: java.io.IOException: Cannot run program "npm" (in directory "/home/user/git/janeasystems/nodejs-mobile-samples-one/cordova/UseNativeModules/platforms/android/build/nodejs-native-assets-temp-build/nodejs-native-assets-armeabi-v7a/nodejs-project"): error=2, No such file or directory
at net.rubygrapefruit.platform.internal.DefaultProcessLauncher.start(DefaultProcessLauncher.java:25)
... 6 more
Caused by: java.io.IOException: error=2, No such file or directory
... 7 more
* Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/4.9/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 23s
4 actionable tasks: 4 executed
Here's the debug of same. It's too many characters for a comment, so I've added a gist.
./gradlew assembleDebug --debug
https://gist.github.com/algorist-mechanism/3e2195ad810f6efb5dfa1f7a03b8da6f#file-gistfile1-txt
Here's build environment for same
~/git/janeasystems/nodejs-mobile-samples-one/cordova/UseNativeModules/platforms/android$ ./gradlew buildEnvironment
> Configure project :CordovaLib
publishNonDefault is deprecated and has no effect anymore. All variants are now published.
> Task :buildEnvironment
------------------------------------------------------------
Root project
------------------------------------------------------------
classpath
\--- com.android.tools.build:gradle:3.2.1
+--- com.android.tools.build:builder:3.2.1
| +--- com.android.tools.build:builder-model:3.2.1
| | \--- com.android.tools:annotations:26.2.1
| +--- com.android.tools.build:builder-test-api:3.2.1
| | \--- com.android.tools.ddms:ddmlib:26.2.1
| | +--- com.android.tools:common:26.2.1
| | | +--- com.android.tools:annotations:26.2.1
| | | +--- com.google.guava:guava:23.0
| | | | +--- com.google.code.findbugs:jsr305:1.3.9
| | | | +--- com.google.errorprone:error_prone_annotations:2.0.18 -> 2.2.0
| | | | +--- com.google.j2objc:j2objc-annotations:1.1
| | | | \--- org.codehaus.mojo:animal-sniffer-annotations:1.14
| | | \--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.2.71
| | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.2.71
| | | | +--- org.jetbrains.kotlin:kotlin-stdlib-common:1.2.71
| | | | \--- org.jetbrains:annotations:13.0
| | | \--- org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.2.71
| | | \--- org.jetbrains.kotlin:kotlin-stdlib:1.2.71 (*)
| | \--- net.sf.kxml:kxml2:2.3.0
| +--- com.android.tools:sdklib:26.2.1
| | +--- com.android.tools.layoutlib:layoutlib-api:26.2.1
| | | +--- com.android.tools:common:26.2.1 (*)
| | | +--- net.sf.kxml:kxml2:2.3.0
| | | +--- com.android.tools:annotations:26.2.1
| | | \--- org.jetbrains:annotations:13.0
| | +--- com.android.tools:dvlib:26.2.1
| | | \--- com.android.tools:common:26.2.1 (*)
| | +--- com.android.tools:repository:26.2.1
| | | +--- com.android.tools:common:26.2.1 (*)
| | | +--- com.sun.activation:javax.activation:1.2.0
| | | +--- org.apache.commons:commons-compress:1.12
| | | +--- org.glassfish.jaxb:jaxb-runtime:2.2.11
| | | | +--- org.glassfish.jaxb:jaxb-core:2.2.11
| | | | | +--- javax.xml.bind:jaxb-api:2.2.12-b140109.1041
| | | | | +--- org.glassfish.jaxb:txw2:2.2.11
| | | | | \--- com.sun.istack:istack-commons-runtime:2.21
| | | | +--- org.jvnet.staxex:stax-ex:1.7.7
| | | | \--- com.sun.xml.fastinfoset:FastInfoset:1.2.13
| | | +--- com.google.jimfs:jimfs:1.1
| | | | \--- com.google.guava:guava:18.0 -> 23.0 (*)
| | | \--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.2.71 (*)
| | +--- com.google.code.gson:gson:2.8.0
| | +--- org.apache.commons:commons-compress:1.12
| | +--- org.apache.httpcomponents:httpmime:4.5.2
| | | \--- org.apache.httpcomponents:httpclient:4.5.2
| | | +--- org.apache.httpcomponents:httpcore:4.4.4 -> 4.4.5
| | | +--- commons-logging:commons-logging:1.2
| | | \--- commons-codec:commons-codec:1.9
| | \--- org.apache.httpcomponents:httpcore:4.4.5
| +--- com.android.tools:sdk-common:26.2.1
| | +--- com.android.tools:sdklib:26.2.1 (*)
| | +--- com.android.tools.build:builder-test-api:3.2.1 (*)
| | +--- com.android.tools.build:builder-model:3.2.1 (*)
| | +--- com.android.tools.ddms:ddmlib:26.2.1 (*)
| | +--- org.bouncycastle:bcpkix-jdk15on:1.56
| | | \--- org.bouncycastle:bcprov-jdk15on:1.56
| | +--- org.bouncycastle:bcprov-jdk15on:1.56
| | +--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.2.71 (*)
| | +--- org.jetbrains.kotlin:kotlin-reflect:1.2.0
| | | \--- org.jetbrains.kotlin:kotlin-stdlib:1.2.0 -> 1.2.71 (*)
| | +--- com.google.protobuf:protobuf-java:3.4.0
| | \--- javax.inject:javax.inject:1
| +--- com.android.tools:common:26.2.1 (*)
| +--- com.android.tools.build:manifest-merger:26.2.1
| | +--- com.android.tools:common:26.2.1 (*)
| | +--- com.android.tools:sdklib:26.2.1 (*)
| | +--- com.android.tools:sdk-common:26.2.1 (*)
| | +--- com.google.code.gson:gson:2.8.0
| | +--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.2.71 (*)
| | \--- net.sf.kxml:kxml2:2.3.0
| +--- com.android.tools.ddms:ddmlib:26.2.1 (*)
| +--- com.android.tools.analytics-library:protos:26.2.1
| | \--- com.google.protobuf:protobuf-java:3.4.0
| +--- com.android.tools.analytics-library:shared:26.2.1
| | +--- com.android.tools.analytics-library:protos:26.2.1 (*)
| | +--- com.android.tools:annotations:26.2.1
| | +--- com.android.tools:common:26.2.1 (*)
| | +--- com.google.guava:guava:23.0 (*)
| | \--- com.google.code.gson:gson:2.8.0
| +--- com.android.tools.analytics-library:tracker:26.2.1
| | +--- com.android.tools:annotations:26.2.1
| | +--- com.android.tools:common:26.2.1 (*)
| | +--- com.android.tools.analytics-library:protos:26.2.1 (*)
| | +--- com.android.tools.analytics-library:shared:26.2.1 (*)
| | +--- com.google.protobuf:protobuf-java:3.4.0
| | \--- com.google.guava:guava:23.0 (*)
| +--- com.android.tools.build:apksig:3.2.1
| +--- com.android.tools.build:apkzlib:3.2.1
| | +--- com.google.code.findbugs:jsr305:1.3.9
| | +--- com.google.guava:guava:23.0 (*)
| | +--- org.bouncycastle:bcpkix-jdk15on:1.56 (*)
| | +--- org.bouncycastle:bcprov-jdk15on:1.56
| | \--- com.android.tools.build:apksig:3.2.1
| +--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.2.71 (*)
| +--- com.squareup:javawriter:2.5.0
| +--- org.bouncycastle:bcpkix-jdk15on:1.56 (*)
| +--- org.bouncycastle:bcprov-jdk15on:1.56
| +--- org.ow2.asm:asm:6.0
| +--- org.ow2.asm:asm-tree:6.0
| | \--- org.ow2.asm:asm:6.0
| +--- org.ow2.asm:asm-commons:6.0
| | \--- org.ow2.asm:asm-tree:6.0 (*)
| +--- org.ow2.asm:asm-util:6.0
| | \--- org.ow2.asm:asm-tree:6.0 (*)
| +--- it.unimi.dsi:fastutil:7.2.0
| +--- net.sf.jopt-simple:jopt-simple:4.9
| \--- com.googlecode.json-simple:json-simple:1.1
+--- com.android.tools.analytics-library:shared:26.2.1 (*)
+--- com.android.tools.analytics-library:crash:26.2.1
| +--- com.android.tools:annotations:26.2.1
| +--- com.google.guava:guava:23.0 (*)
| +--- org.apache.httpcomponents:httpmime:4.5.2 (*)
| +--- org.apache.httpcomponents:httpcore:4.4.5
| \--- org.apache.httpcomponents:httpclient:4.5.2 (*)
+--- com.android.tools.lint:lint-gradle-api:26.2.1
| +--- com.android.tools:sdklib:26.2.1 (*)
| +--- com.android.tools.build:builder-model:3.2.1 (*)
| +--- com.android.tools.build:gradle-api:3.2.1
| | +--- com.android.tools.build:builder-model:3.2.1 (*)
| | +--- com.android.tools.build:builder-test-api:3.2.1 (*)
| | +--- com.google.guava:guava:23.0 (*)
| | \--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.2.71 (*)
| +--- org.jetbrains.kotlin:kotlin-reflect:1.2.0 (*)
| +--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.2.71 (*)
| \--- com.google.guava:guava:23.0 (*)
+--- com.android.tools.build:gradle-api:3.2.1 (*)
+--- androidx.databinding:databinding-compiler-common:3.2.1
| +--- androidx.databinding:databinding-common:3.2.1
| +--- com.android.databinding:baseLibrary:3.2.1
| +--- org.antlr:antlr4:4.5.3
| +--- commons-io:commons-io:2.4
| +--- com.googlecode.juniversalchardet:juniversalchardet:1.0.3
| +--- com.google.guava:guava:23.0 (*)
| +--- com.squareup:javapoet:1.8.0
| +--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.2.71 (*)
| +--- com.google.code.gson:gson:2.8.0
| +--- com.android.tools:annotations:26.2.1
| \--- com.android.tools.build.jetifier:jetifier-core:1.0.0-alpha10
| +--- com.google.code.gson:gson:2.8.0
| \--- org.jetbrains.kotlin:kotlin-stdlib:1.2.20 -> 1.2.71 (*)
+--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.2.71 (*)
+--- com.android.tools.build:transform-api:2.0.0-deprecated-use-gradle-api
+--- org.ow2.asm:asm:6.0
+--- org.ow2.asm:asm-analysis:6.0
| \--- org.ow2.asm:asm-tree:6.0 (*)
+--- org.ow2.asm:asm-commons:6.0 (*)
+--- org.ow2.asm:asm-util:6.0 (*)
+--- net.sf.jopt-simple:jopt-simple:4.9
+--- net.sf.proguard:proguard-gradle:6.0.3
| \--- net.sf.proguard:proguard-base:6.0.3
+--- com.android.tools.build:bundletool:0.5.0
| +--- com.google.auto.value:auto-value:1.5.2
| +--- com.android.tools.build:aapt2-proto:0.3.1
| | \--- com.google.protobuf:protobuf-java:3.4.0
| +--- com.google.errorprone:error_prone_annotations:2.2.0
| +--- com.google.guava:guava:22.0 -> 23.0 (*)
| +--- com.google.protobuf:protobuf-java:3.4.0
| \--- com.google.protobuf:protobuf-java-util:3.4.0
| +--- com.google.protobuf:protobuf-java:3.4.0
| +--- com.google.guava:guava:19.0 -> 23.0 (*)
| \--- com.google.code.gson:gson:2.7 -> 2.8.0
+--- com.android.tools.build.jetifier:jetifier-core:1.0.0-alpha10 (*)
\--- com.android.tools.build.jetifier:jetifier-processor:1.0.0-alpha10
+--- org.ow2.asm:asm:6.0
+--- org.ow2.asm:asm-util:6.0 (*)
+--- org.ow2.asm:asm-commons:6.0 (*)
+--- org.jdom:jdom2:2.0.6
+--- org.jetbrains.kotlin:kotlin-stdlib:1.2.20 -> 1.2.71 (*)
\--- com.android.tools.build.jetifier:jetifier-core:1.0.0-alpha10 (*)
(*) - dependencies omitted (listed previously)
A web-based, searchable dependency report is available by adding the --scan option.
Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/4.9/userguide/command_line_interface.html#sec:command_line_warnings
BUILD SUCCESSFUL in 1s
1 actionable task: 1 executed
So perhaps it's node and npm are not available to gradle. So it tried the following from https://www.digitalocean.com/community/tutorials/how-to-install-node-js-with-nvm-node-version-manager-on-a-vps
n=$(which node);n=${n%/bin/node}; chmod -R 755 $n/bin/*; sudo cp -r $n/{bin,lib,share} /usr/local
n=$(which npm);n=${n%/bin/npm}; chmod -R 755 $n/bin/*; sudo cp -r $n/{bin,lib,share} /usr/local
But I get the same error.
Hi @algorist-mechanism ,
I have the same opinion: that gradle is unable to call npm on your machine.
./gradlew assembleDebug --stacktrace
might give you the "File not found" exception when this is the case.
Perhaps it's because of the nvm
use. Try it without nvm
use to see if that's the issue. The file you shared shows us how gradle is trying to run npm
and its environment: https://gist.github.com/algorist-mechanism/3e2195ad810f6efb5dfa1f7a03b8da6f#file-gistfile1-txt-L4329-L4330
Building the native libraries for use in native applications is not currently supported. They currently have to be cross-compiled for Android. The gradle file in the plugins can be looked at to understand how this is achieved: https://github.com/janeasystems/nodejs-mobile-cordova/blob/be459ac4702a825a9254be03fc9448a5487436db/src/android/build.gradle#L206-L242
Hi @algorist-mechanism , @jaimecbernardo ,
I try pouchdb version 7.0.0 and I have the same issue:
_UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: dlopen failed: cannot locate symbol "napi_create_external" referenced by "/data/data/com.yourorg.sample/files/nodejs-project/node_modules/pouchdb/nodemodules/leveldown/prebuilds/android-arm/node-napi.node"...
Have you solved this problem? Thanks
Hi @bavuvanet ,
For native modules, you'd need to rebuild them linking against the nodejs-mobile shared libraries, otherwise they won't be correctly link at runtime on Android. (more information in https://github.com/janeasystems/nodejs-mobile-gyp/issues/4 )
A possible method of achieving this is implemented in the cordova and react-native plugins.
i fix similar issue by copy older ndk files to current ndk folder
older ndk from https://developer.android.com/ndk/downloads/older_releases
This time i tried ndk 21, 20, 19, 18, 17, and 16. And only android-ndk-r16b
contains mipsel-linux-android
in toolchains
.
error message
No toolchains found in the NDK toolchains folder for ABI with prefix: mipsel-linux-android
steps to fix it:
export ANDROID_NDK_HOME="$HOME/Library/Android/sdk/ndk/21.2.6472646"
to your ~/.bash_profile
or ~/.zshrc
android-ndk-r16b
from ndk older releaseandroid-ndk-r16b/toolchains/mips64el-linux-android-4.9
to $HOME/Library/Android/sdk/ndk/21.2.6472646/toolchains
Tried to use leveldown as a native module in android native-gradle-node-folder sample project.
Steps:
nvm use 8.6.0
git clone https://github.com/janeasystems/nodejs-mobile.git
cd nodejs-mobile
./android-configure <.../ndk-bundle/> arm64
NDK toolchain already exists. Replace it? [y/N]y HOST_OS=linux HOST_EXE= HOST_ARCH=x86_64 HOST_TAG=linux-x86_64 HOST_NUM_CPUS=4 BUILD_NUM_CPUS=8 Toolchain installed to /home/user/git/janeasystems/nodejs-mobile/android-toolchain. creating ./icu_config.gypi { 'target_defaults': { 'cflags': [], 'default_configuration': 'Release', 'defines': [], 'include_dirs': [], 'libraries': []}, 'variables': { 'OS': 'android', 'asan': 0, 'coverage': 'false', 'debug_devtools': 'node', 'debug_http2': 'false', 'debug_nghttp2': 'false', 'force_dynamic_crt': 1, 'host_arch': 'arm64', 'icu_small': 'false', 'llvm_version': '7.0', 'node_byteorder': 'little', 'node_enable_d8': 'false', 'node_enable_v8_vtunejit': 'false', 'node_engine': 'v8', 'node_install_npm': 'true', 'node_module_version': 57, 'node_no_browser_globals': 'false', 'node_prefix': '/usr/local', 'node_release_urlbase': '', 'node_shared': 'true', 'node_shared_cares': 'false', 'node_shared_http_parser': 'false', 'node_shared_libuv': 'false', 'node_shared_openssl': 'false', 'node_shared_zlib': 'false', 'node_tag': '', 'node_use_bundled_v8': 'true', 'node_use_dtrace': 'false', 'node_use_etw': 'false', 'node_use_lttng': 'false', 'node_use_openssl': 'true', 'node_use_perfctr': 'false', 'node_use_v8_platform': 'true', 'node_without_node_options': 'false', 'openssl_fips': '', 'openssl_no_asm': 1, 'shlib_suffix': 'so', 'target_arch': 'arm64', 'v8_enable_gdbjit': 0, 'v8_enable_i18n_support': 0, 'v8_enable_inspector': 0, 'v8_no_strict_aliasing': 1, 'v8_optimized_debug': 0, 'v8_promise_internal_field_count': 1, 'v8_random_seed': 0, 'v8_trace_maps': 0, 'v8_use_snapshot': 'false', 'want_separate_host_toolset': 0}} creating ./config.gypi creating ./config.mk
npm config set arch=arm64
git clone https://github.com/janeasystems/nodejs-mobile-samples.git
download https://github.com/janeasystems/nodejs-mobile/releases/download/nodejs-mobile-v0.1.8/nodejs-mobile-v0.1.8-android.zip extract and copy bin & include directories to ..git/janeasystems/nodejs-mobile-samples/android/native-gradle-node-folder/app/libnode
cd nodejs-mobile-samples/android/native-gradle-node-folder/app/src/main/assets/nodejs-project
create main.js with following:
var PouchDB = require('pouchdb'); var express = require('express'); var app = express();
app.use('/db', require('express-pouchdb')(PouchDB));
app.listen(3000);
create package.json with following: { "name": "test-app", "version": "1", "description": "node pouchdb", "main": "main.js", "dependencies": { "express": "^4.16.3", "express-pouchdb": "^4.1.0", "nan": "^2.11.0", "node-gyp": "^3.8.0", "pouchdb": ">=7.0.0" } }
npm install --arch=arm64
pouchdb uses incorrect level and leveldown versions (corrected in 7.0.0-prerelease which isn't published to npm yet.) cd node_modules/pouchdb
change in package.json "dependencies": { "level": "3.0.2", to "level": "4.0.0", "leveldown": "3.0.0", to "leveldown": "4.0.1" }
cd ../.. npm rebuild --arch=arm64
import janeasystems/nodejs-mobile-samples/android/native-gradle-node-folder as gradle project
build and debug on android 64 bit device Note: app/build.gradle has following: externalNativeBuild { cmake { cppFlags "" arguments "-DANDROID_STL=c++_shared" } }
get the following error which looks like a missing c++_shared .so
2019-01-09 11:57:36.993 8137-8255/com.yourorg.sample E/NODEJS-MOBILE: /data/data/com.yourorg.sample/files/nodejs-project/node_modules/pouchdb/node_modules/bindings/bindings.js:91 throw e ^