Android build error in windows


#1

this was working in ubuntu but in windows I am not getting why this

  location: variable myStatement of type SQLiteStatement
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
13 errors

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.


#2

Please post the complete output, not just this little part.
Also please post your ionic info and cordova requirements output. Thanks.


#3

ionic cordova build android
[WARN] The Ionic CLI has an update available! Please upgrade (you might need sudo):

       npm install -g ionic@latest
Running app-scripts build: --iscordovaserve --external-ip-required --nobrowser

[09:10:36]  build dev started ...
[09:10:36]  clean started ...
[09:10:36]  clean finished in less than 1 ms
[09:10:36]  copy started ...
[09:10:36]  transpile started ...
[09:10:38]  transpile finished in 2.01 s
[09:10:38]  preprocess started ...
[09:10:38]  deeplinks started ...
[09:10:38]  deeplinks finished in 54 ms
[09:10:38]  preprocess finished in 55 ms
[09:10:43]  sass started ...
[09:10:44]  sass finished in 1.42 s
[09:10:44]  postprocess started ...
[09:10:44]  postprocess finished in less than 1 ms
[09:10:44]  lint started ...
[09:10:44]  build dev finished in 8.58 s
> cordova build android
[09:10:46]  lint finished in 2.25 s
✖ Running command - failed!

[ERROR] Cordova encountered an error.
You may get more insight by running the Cordova command above directly.

[ERROR] An error occurred while running cordova build android (exit code 1):

    (truncated) ... od columnString(int)
      location: variable myStatement of type SQLiteStatement
    Note: Some input files use or override a deprecated API.
    Note: Recompile with -Xlint:deprecation for details.
    13 errors
    :compileDebugJavaWithJavac FAILED

    FAILURE: Build failed with an exception.

    * What went wrong:
    Execution failed for task ':compileDebugJavaWithJavac'.
    > Compilation failed; see the compiler error output for details.

    * Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

    BUILD FAILED
Total time: 19.385 secs
        Error: cmd: Command failed with exit code 1 Error output:
        C:\Ionic Project\bucket\platforms\android\src\io\liteglue\SQLitePlugin.java:374: error: SQLiteConnection is abstract; cannot be instantiated
                mydb = new SQLiteConnection(dbFile);
                       ^
        C:\Ionic Project\bucket\platforms\android\src\io\liteglue\SQLitePlugin.java:375: error: cannot find symbol
                mydb.open(true); /* create if db does not exist */
                    ^
          symbol:   method open(boolean)
          location: variable mydb of type SQLiteConnection
        C:\Ionic Project\bucket\platforms\android\src\io\liteglue\SQLitePlugin.java:433: error: cannot find symbol
                            long insertId = mydb.getLastInsertId();
                                                ^
          symbol:   method getLastInsertId()
          location: variable mydb of type SQLiteConnection
        C:\Ionic Project\bucket\platforms\android\src\io\liteglue\SQLitePlugin.java:486: error: cannot find symbol
                SQLiteStatement myStatement = mydb.prepare(query);
                                                  ^
          symbol:   method prepare(String)
          location: variable mydb of type SQLiteConnection
        C:\Ionic Project\bucket\platforms\android\src\io\liteglue\SQLitePlugin.java:499: error: cannot find symbol
                                myStatement.bind(i + 1, paramsAsJson.getDouble(i));
 symbol:   method bind(int,double)
          location: variable myStatement of type SQLiteStatement
        C:\Ionic Project\bucket\platforms\android\src\io\liteglue\SQLitePlugin.java:501: error: cannot find symbol
                                myStatement.bind(i + 1, paramsAsJson.getLong(i));
                                           ^
          symbol:   method bind(int,long)
          location: variable myStatement of type SQLiteStatement
        C:\Ionic Project\bucket\platforms\android\src\io\liteglue\SQLitePlugin.java:503: error: cannot find symbol
                                myStatement.bind(i + 1, paramsAsJson.getString(i));
                                           ^
          symbol:   method bind(int,String)
          location: variable myStatement of type SQLiteStatement
        C:\Ionic Project\bucket\platforms\android\src\io\liteglue\SQLitePlugin.java:522: error: cannot find symbol
                    int colCount = myStatement.columnCount();
                                              ^
          symbol:   method columnCount()
          location: variable myStatement of type SQLiteStatement
        C:\Ionic Project\bucket\platforms\android\src\io\liteglue\SQLitePlugin.java:531: error: cannot find symbol
                                switch (myStatement.columnType(i)) {
(use -source 7 or higher to enable strings in switch)
        C:\Ionic Project\bucket\platforms\android\src\io\liteglue\SQLitePlugin.java:537: error: cannot find symbol
                                    row.put(key, myStatement.columnDouble(i));
                                                            ^
          symbol:   method columnDouble(int)
          location: variable myStatement of type SQLiteStatement
        C:\Ionic Project\bucket\platforms\android\src\io\liteglue\SQLitePlugin.java:541: error: cannot find symbol
                                    row.put(key, myStatement.columnLong(i));
                                                            ^
          symbol:   method columnLong(int)
          location: variable myStatement of type SQLiteStatement
        C:\Ionic Project\bucket\platforms\android\src\io\liteglue\SQLitePlugin.java:547: error: cannot find symbol
                                    row.put(key, myStatement.columnString(i));
                                                            ^
          symbol:   method columnString(int)
          location: variable myStatement of type SQLiteStatement
        Note: Some input files use or override a deprecated API.
        Note: Recompile with -Xlint:deprecation for details.
        13 errors
 FAILURE: Build failed with an exception.

        * What went wrong:
        Execution failed for task ':compileDebugJavaWithJavac'.
        > Compilation failed; see the compiler error output for details.

        * Try:
        Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

ionic info

[WARN] The Ionic CLI has an update available! Please upgrade (you might need sudo):

       npm install -g ionic@latest

global packages:

    @ionic/cli-utils : 1.1.2
    Cordova CLI      : 7.0.1
    Ionic CLI        : 3.1.2

local packages:

    @ionic/app-scripts              : 1.3.7
    @ionic/cli-plugin-cordova       : 1.2.1
    @ionic/cli-plugin-ionic-angular : 1.2.0
    Cordova Platforms               : android 6.2.3
    Ionic Framework                 : ionic-angular 3.2.1

System:

    Node       : v7.4.0
    OS         : Windows 7
    Xcode      : not installed
    ios-deploy : not installed

cordova requirements

Requirements check results for android:
Java JDK: installed 1.8.0
Android SDK: installed true
Android target: installed android-25,android-24,android-23,android-22,android-21
Gradle: installed C:\Program Files\Android\Android Studio\gradle\gradle-2.14.1\bin\gradle

#4

Obviously something is wrong with your SQLite plugin - this should throw these errors.

Post your ionic cordova plugin list and package.json content please.

Try to reinstall this plugin or remove and re-add the android platform - this quite often fixes stuff like this already.

The exact same code worked on Ubuntu and could build an app?


#5

package.json

{
  "name": "ionic",
  "version": "0.0.1",
  "author": "Ionic Framework",
  "homepage": "http://ionicframework.com/",
  "private": true,
  "scripts": {
    "clean": "ionic-app-scripts clean",
    "build": "ionic-app-scripts build",
    "lint": "ionic-app-scripts lint",
    "ionic:build": "ionic-app-scripts build",
    "ionic:serve": "ionic-app-scripts serve"
  },
  "dependencies": {
    "@angular/common": "4.1.0",
    "@angular/compiler": "4.1.0",
    "@angular/compiler-cli": "4.1.0",
    "@angular/core": "4.1.0",
    "@angular/forms": "4.1.0",
    "@angular/http": "4.1.0",
    "@angular/platform-browser": "4.1.0",
    "@angular/platform-browser-dynamic": "4.1.0",
    "@ionic-native/camera": "^3.10.3",
    "@ionic-native/core": "3.7.0",
    "@ionic-native/file": "^3.10.3",
    "@ionic-native/file-path": "^3.10.3",
    "@ionic-native/splash-screen": "3.7.0",
    "@ionic-native/sqlite": "^3.10.3",
    "@ionic-native/status-bar": "3.7.0",
    "@ionic-native/transfer": "^3.10.3",
    "@ionic/storage": "2.0.1",
    "angular2-signaturepad": "^2.4.0",
    "animate.css": "^3.5.2",
    "cordova-android": "^6.2.3",
    "cordova-ios": "^4.4.0",
    "cordova-plugin-camera": "^2.4.1",
    "cordova-plugin-compat": "^1.0.0",
    "cordova-plugin-console": "^1.0.5",
    "cordova-plugin-device": "^1.1.4",
    "cordova-plugin-file": "^4.3.3",
    "cordova-plugin-file-transfer": "^1.6.3",
    "cordova-plugin-filepath": "^1.0.2",
    "cordova-plugin-splashscreen": "^4.0.3",
    "cordova-plugin-sqlite": "^1.0.3",
    "cordova-plugin-sqlite-2": "^1.0.4",
    "cordova-plugin-statusbar": "^2.2.2",
    "cordova-plugin-whitelist": "^1.3.1",
    "cordova-sqlite-storage": "^2.0.4",
    "ionic-angular": "3.2.1",
    "ionic-plugin-keyboard": "^2.2.1",
    "ionicons": "3.0.0",
    "platform": "^1.3.4",
    "rxjs": "5.1.1",
    "sw-toolbox": "3.6.0",
    "zone.js": "0.8.10"
  },
  "devDependencies": {
    "@ionic/app-scripts": "1.3.7",
    "@ionic/cli-plugin-cordova": "^1.2.1",
    "@ionic/cli-plugin-ionic-angular": "^1.2.0",
    "typescript": "2.2.1"
  },
  "description": "An Ionic project",
  "cordova": {
    "plugins": {
      "cordova-plugin-console": {},
      "cordova-plugin-device": {},
      "cordova-plugin-splashscreen": {},
      "cordova-plugin-statusbar": {},
      "cordova-plugin-whitelist": {},
      "ionic-plugin-keyboard": {},
      "cordova-sqlite-storage": {},
      "cordova-plugin-sqlite-2": {},
      "cordova-plugin-sqlite": {}
    },
    "platforms": [
      "android"
    ]
  }
}

ionic cordova plugin list

cordova plugin ls
:heavy_check_mark: Running command - done!

cordova-plugin-compat 1.0.0 "Compat"
cordova-plugin-console 1.0.5 "Console"
cordova-plugin-device 1.1.4 "Device"
cordova-plugin-file 4.3.3 "File"
cordova-plugin-file-transfer 1.6.3 "File Transfer"
cordova-plugin-filepath 1.0.2 "FilePath"
cordova-plugin-splashscreen 4.0.3 "Splashscreen"
cordova-plugin-sqlite 1.0.3 "Cordova Sqllite Plugine"
cordova-plugin-sqlite-2 1.0.4 "SQLitePlugin"
cordova-plugin-statusbar 2.2.2 "StatusBar"
cordova-plugin-whitelist 1.3.1 "Whitelist"
cordova-sqlite-storage 2.0.4 "Cordova sqlite storage plugin"
ionic-plugin-keyboard 2.2.1 "Keyboard"

#6

Having these both installed at the same time is probably possible, but sure confusing. Which one are you using? You have the Ionic Native Plugin installed for one of these - which one does it belong to?


#7

1st one only I am using


#8

still not getting finding the same error


#9

hey now its working but I removed cordova-plugin-sqlite and cordova-plugin-sqlite-2 I think this can make a problem at the time of using sqlite so please clear me one thing at the of using sqlite it imports from ionic-native/sqlite so when plugin will get in use