Build APK file (Android)

Hello.
I have an application ready and I would like to generate the APK file with this command

framework7 cordova build android

but the console shows me such an error

Checking Java JDK and Android SDK versions
ANDROID_SDK_ROOT=undefined (recommended setting)
ANDROID_HOME=undefined (DEPRECATED)
Failed to find 'ANDROID_SDK_ROOT' environment variable. Try setting it manually.
Detected 'adb' command at C:\adb but no 'platform-tools' directory found near.
Try reinstall Android SDK or update your PATH to include valid path to SDK\platform-tools directory.
C:\Users\Mateusz\AppData\Roaming\npm\node_modules\framework7-cli\node_modules\exec-sh\lib\exec-sh.js:73
      var e = new Error('Shell command exit with non zero code: ' + code)
              ^

Error: Shell command exit with non zero code: 1
    at ChildProcess.<anonymous> (C:\Users\Mateusz\AppData\Roaming\npm\node_modules\framework7-cli\node_modules\exec-sh\lib\exec-sh.js:73:15)
    at ChildProcess.emit (node:events:329:20)
    at maybeClose (node:internal/child_process:1055:16)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:288:5) {
  code: 1,
  stdout: '',
  stderr: ''

I don’t have this folders
C:\Users\Mateusz\AppData\Local\ Android\sdk

Android Studio installed, and still problems

edit.
It’s working now

1 Like

What have you done to make it work?

  1. Make cordova project cordova create
  2. Add your platform cordova platform add
  3. Build cordova project. cordova build
  4. Add framework7 framework7 create
  5. Add your platform in framework7 framework7 cordova platform add
  6. Build framework7 app npm run build-prod-cordova

and basically most of the stuff in this documentation (e.g environment variables) https://cordova.apache.org/docs/en/latest/guide/platforms/android/index.html

1 Like

I also have a problem with my apk file

Other solution in framework7 v6