oracle-jet

Oracle JET: Getting error while launching ojet hybrid app for android


Android emulator shows error when we launch a bare bone app, please see the screenshot attached. It works as expected for iOS.

I have tried all the default templates navbar,navdrawer and blank.

screenshot

This is an app directly from the getting started page and no modifications have been made to the template code.

Last login: Wed Aug 26 11:02:18 on ttys000

~                                                                              
▶ cd Desktop 

~/Desktop                                                                      
▶ ojet create myapp --template= navbar:hybrid

~/Desktop                                                                      
▶ cd myapp 

~/Desktop/myapp                                                                
▶ ojet add hybrid
? Please choose the platforms you want to install Android, iOS
Adding platform: android
Using cordova-fetch for cordova-android@^9.0.0


Adding android project...


Creating Cordova project for the Android platform:

    Path: platforms/android
    Package: org.oraclejet.myapp
    Name: myapp
    Activity: MainActivity
    Android target: android-29


Subproject Path: CordovaLib

Subproject Path: app

Android project created with cordova-android@9.0.0

Discovered plugin "cordova-plugin-whitelist". Adding it to the project


Installing "cordova-plugin-whitelist" for android

Adding cordova-plugin-whitelist to package.json


Adding platform: ios
Using cordova-fetch for cordova-ios@^6.1.0


Adding ios project...


Creating Cordova project for the iOS platform:

    Path: platforms/ios
    Package: org.oraclejet.myapp
    Name: myapp

iOS project created with cordova-ios@6.1.0


Installing "cordova-plugin-whitelist" for ios

Adding platform: browser
Using cordova-fetch for cordova-browser@^6.0.0


Adding browser project...


Creating Cordova project for cordova-browser:

    Path: /Users/hellonuh/Desktop/myapp/hybrid/platforms/browser
    Name: myapp

Installing "cordova-plugin-whitelist" for browser

6.0.0

Add hybrid finished.

~/Desktop/myapp                                                                
▶ ojet serve android                         
Build: true
BuildType: dev
Destination: emulator
Destination target: undefined
Livereload: true
Livereload port: 35729
Platform: android
Theme: redwood
Theme platform: android
Theme version: 9.1.0
Building app.
Cleaning staging path.
Running before_build hook.
Copy files to staging directory.
Copy finished.
Copy library files to staging directory.
Copy finished.
Copy reference components to staging directory.
Copy finished.
Copy local web components
Copy local web components skipped
Optimizing svg into SVG sprites.
Svg optimization task finished.
Compiling sass...
Sass compile finished.
Task index.html cdn bundle injection finished.
Running theme copy task.
Theme copy task finished.
Running theme injection task.
Task index.html theme path injection finished.
Injecting index.html with cordova script.
Running injection tasks.
Task main.js paths injection finished.
runAllComponentHooks 
Running after_build hook.
Running before_serve hook.
Executing: cordova clean android
Checking Java JDK and Android SDK versions

ANDROID_SDK_ROOT=undefined (recommended setting)
ANDROID_HOME=undefined (DEPRECATED)

Using Android SDK: /Users/hellonuh/Library/Android/sdk

> Task :wrapper


BUILD SUCCESSFUL in 1s
1 actionable task: 1 executed


Subproject Path: CordovaLib


Subproject Path: app


> Task :clean UP-TO-DATE

> Task :app:clean UP-TO-DATE
> Task :CordovaLib:clean
 UP-TO-DATE


BUILD SUCCESSFUL
 in 1s

3 actionable tasks: 3 up-to-date

child process exited with code: 0
Executing: cordova serve 
Plugin 'cordova-plugin-wkwebview-file-xhr' found in config.xml... Migrating it to package.json


Plugin 'cordova-plugin-wkwebview-engine' found in config.xml... Migrating it to package.json


Discovered plugin "cordova-plugin-wkwebview-file-xhr". Adding it to the project


Installing "cordova-plugin-wkwebview-file-xhr" for android


Installing "cordova-plugin-wkwebview-engine" for android


Failed to install 'cordova-plugin-wkwebview-engine': Error: ENOENT: no such file or directory, open '/Users/hellonuh/Desktop/myapp/hybrid/platforms/android/app/src/main/assets/www/cordova_plugins.js'
    at Object.openSync (fs.js:462:3)
    at Object.writeFileSync (fs.js:1362:35)
    at /Users/hellonuh/Desktop/myapp/hybrid/node_modules/cordova-common/src/PluginManager.js:132:20
    at _fulfilled (/Users/hellonuh/Desktop/myapp/hybrid/node_modules/q/q.js:854:54)
    at /Users/hellonuh/Desktop/myapp/hybrid/node_modules/q/q.js:883:30
    at Promise.promise.promiseDispatch (/Users/hellonuh/Desktop/myapp/hybrid/node_modules/q/q.js:816:13)
    at /Users/hellonuh/Desktop/myapp/hybrid/node_modules/q/q.js:877:14
    at runSingle (/Users/hellonuh/Desktop/myapp/hybrid/node_modules/q/q.js:137:13)
    at flush (/Users/hellonuh/Desktop/myapp/hybrid/node_modules/q/q.js:125:13)
    at processTicksAndRejections (internal/process/task_queues.js:79:11)


Failed to install 'cordova-plugin-wkwebview-file-xhr': Error: ENOENT: no such file or directory, open '/Users/hellonuh/Desktop/myapp/hybrid/platforms/android/app/src/main/assets/www/cordova_plugins.js'
    at Object.openSync (fs.js:462:3)
    at Object.writeFileSync (fs.js:1362:35)
    at /Users/hellonuh/Desktop/myapp/hybrid/node_modules/cordova-common/src/PluginManager.js:132:20
    at _fulfilled (/Users/hellonuh/Desktop/myapp/hybrid/node_modules/q/q.js:854:54)
    at /Users/hellonuh/Desktop/myapp/hybrid/node_modules/q/q.js:883:30
    at Promise.promise.promiseDispatch (/Users/hellonuh/Desktop/myapp/hybrid/node_modules/q/q.js:816:13)
    at /Users/hellonuh/Desktop/myapp/hybrid/node_modules/q/q.js:877:14
    at runSingle (/Users/hellonuh/Desktop/myapp/hybrid/node_modules/q/q.js:137:13)
    at flush (/Users/hellonuh/Desktop/myapp/hybrid/node_modules/q/q.js:125:13)
    at processTicksAndRejections (internal/process/task_queues.js:79:11)


Failed to restore plugin "cordova-plugin-wkwebview-file-xhr". You might need to try adding it again. Error: Error: ENOENT: no such file or directory, open '/Users/hellonuh/Desktop/myapp/hybrid/platforms/android/app/src/main/assets/www/cordova_plugins.js'


Static file server running on: http://localhost:8000 (CTRL + C to shut down)
Executing: cordova run android --emulator --debug


Checking Java JDK and Android SDK versions

ANDROID_SDK_ROOT=undefined (recommended setting)
ANDROID_HOME=undefined (DEPRECATED)

Using Android SDK: /Users/hellonuh/Library/Android/sdk

Subproject Path: CordovaLib


Subproject Path: app

> Task :app:preBuild UP-TO-DATE

> Task :app:preDebugBuild UP-TO-DATE

> Task :CordovaLib:preBuild UP-TO-DATE


> Task :CordovaLib:preDebugBuild
 UP-TO-DATE

> Task :CordovaLib:compileDebugAidl NO-SOURCE
> Task :app:compileDebugAidl NO-SOURCE
> Task :CordovaLib:packageDebugRenderscript
 NO-SOURCE

> Task :app:compileDebugRenderscript NO-SOURCE

> Task :app:generateDebugBuildConfig

> Task :app:generateDebugResValues
> Task :app:generateDebugResources


> Task :CordovaLib:compileDebugRenderscript

> Task :CordovaLib:generateDebugResValues
> Task :CordovaLib:generateDebugResources
> Task :CordovaLib:packageDebugResources

> Task :app:createDebugCompatibleScreenManifests

> Task :app:extractDeepLinksDebug
> Task :CordovaLib:extractDeepLinksDebug
> Task :app:javaPreCompileDebug

> Task :CordovaLib:compileDebugLibraryResources


> Task :CordovaLib:generateDebugBuildConfig

> Task :app:mergeDebugShaders
> Task :app:compileDebugShaders NO-SOURCE
> Task :app:generateDebugAssets
 UP-TO-DATE
> Task :CordovaLib:mergeDebugShaders
> Task :CordovaLib:compileDebugShaders NO-SOURCE
> Task :CordovaLib:generateDebugAssets
 UP-TO-DATE
> Task :CordovaLib:packageDebugAssets

> Task :app:mergeDebugAssets

> Task :app:processDebugJavaRes NO-SOURCE
> Task :CordovaLib:processDebugJavaRes NO-SOURCE

> Task :CordovaLib:bundleLibResDebug NO-SOURCE

> Task :app:checkDebugDuplicateClasses
> Task :app:desugarDebugFileDependencies
> Task :app:mergeDebugJavaResource
> Task :app:mergeDebugJniLibFolders

> Task :CordovaLib:mergeDebugJniLibFolders
> Task :app:validateSigningDebug

> Task :app:mergeExtDexDebug

> Task :CordovaLib:mergeDebugNativeLibs

> Task :CordovaLib:stripDebugDebugSymbols
 NO-SOURCE

> Task :CordovaLib:copyDebugJniLibsProjectOnly

> Task :CordovaLib:parseDebugLocalResources


> Task :CordovaLib:javaPreCompileDebug

> Task :CordovaLib:processDebugManifest

> Task :app:processDebugManifest
> Task :app:mergeDebugResources
> Task :CordovaLib:generateDebugRFile

> Task :app:processDebugResources


> Task :CordovaLib:compileDebugJavaWithJavac
> Task :app:mergeDebugNativeLibs
> Task :app:stripDebugDebugSymbols NO-SOURCE
> Task :CordovaLib:bundleLibCompileToJarDebug

> Task :app:compileDebugJavaWithJavac

> Task :app:compileDebugSources
> Task :CordovaLib:bundleLibRuntimeToJarDebug

> Task :app:dexBuilderDebug

> Task :app:mergeProjectDexDebug

> Task :app:mergeLibDexDebug


> Task :app:packageDebug

> Task :app:assembleDebug
> Task :app:cdvBuildDebug



Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.5/userguide/command_line_interface.html#sec:command_line_warnings

BUILD SUCCESSFUL in 6s

40 actionable tasks: 40 executed

Built the following apk(s): 
    /Users/hellonuh/Desktop/myapp/hybrid/platforms/android/app/build/outputs/apk/debug/app-debug.apk


Checking Java JDK and Android SDK versions

ANDROID_SDK_ROOT=/Users/hellonuh/Library/Android/sdk (recommended setting)
ANDROID_HOME=undefined (DEPRECATED)

Using Android SDK: /Users/hellonuh/Library/Android/sdk

Using apk: /Users/hellonuh/Desktop/myapp/hybrid/platforms/android/app/build/outputs/apk/debug/app-debug.apk

Package name: org.oraclejet.myapp

INSTALL SUCCESS


LAUNCH SUCCESS
Starting watcher.
Running after_serve hook.
(node:3931) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'liveReloadServer' of undefined
    at /Users/hellonuh/Desktop/myapp/node_modules/@oracle/oraclejet-tooling/lib/serve/watch.js:65:28
    at new Promise (<anonymous>)
    at _startLiveReloadServer (/Users/hellonuh/Desktop/myapp/node_modules/@oracle/oraclejet-tooling/lib/serve/watch.js:64:10)
    at /Users/hellonuh/Desktop/myapp/node_modules/@oracle/oraclejet-tooling/lib/serve/watch.js:40:7
    at new Promise (<anonymous>)
    at module.exports (/Users/hellonuh/Desktop/myapp/node_modules/@oracle/oraclejet-tooling/lib/serve/watch.js:38:10)
    at /Users/hellonuh/Desktop/myapp/node_modules/@oracle/oraclejet-tooling/lib/serveHybrid.js:42:9
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:3931) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:3931) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.


child process exited with code: 0
^C

~/Desktop/myapp                                                               ⍉
▶ ojet serve ios                             
^C

~/Desktop/myapp                                                               ⍉
▶ 


Solution

  • No need for an additional plugin to be added to your app. You can simply add this line to your AndroidManifest.xml file and it will work. This should only be needed during development as once you publish the app using --release, it will use https and cleartext will not be used.

    Inside the <application ... /> tag, add

    The AndroidManifest.xml file is located by default in

    /hybrid/platforms/android/app/src/main