an-rahulpandey / cordova-plugin-dbcopy

Copy SQLite Database from www folder to default app database location
Apache License 2.0
89 stars 47 forks source link

Phonegap build failed with latest version (2.1.1) #57

Closed trusteddigital closed 5 years ago

trusteddigital commented 5 years ago

Please excuse me if I've not provided enough info or done something stupid.

I've just ran a new build through Phonegap Build for the first time since January (when it compiled successfully) and failed with the error message below. It warned to check any plugins using databasehelper.java of which this the the only one.

I hadn't specified a version of the plugin to use so it was pulling the latest from NPM. In January I think that would have been 2.0.0.

So when I specified to use 2.0.0, it compiled okay. Any pointers? Or do you need any more info?

BUILD FAILED

Total time: 2.125 secs Error: /project/gradlew: Command failed with exit code 1 Error output: Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. /project/src/me/rahul/plugins/sqlDB/DatabaseHelper.java:41: error: cannot find symbol if(Build.VERSION.SDK_INT > android.os.Build.VERSION_CODES.O) { ^ symbol: variable O location: class VERSION_CODES Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: Some input files use unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. 1 error

FAILURE: Build failed with an exception.

an-rahulpandey commented 5 years ago

What is your target sdk version? Can you try setting it as 26?

trusteddigital commented 5 years ago

Interesting. Phonegap Build defaults to 25. Changing to 26, I don't have that particular error now. But a whole lot of others which likely relate to other plugins. I'll work through those then confirm that this is sorted on that SDK. Apologies if I missed that this is written somewhere about minimum SDK versions.

an-rahulpandey commented 5 years ago

Ah! I have not added it in the doc, will add it. I added that minimum sdk requirements very recently, since in Android 9 it is required to close the database.

svereecke commented 5 years ago

So this is a breaking change, if target version is lower then 26 ? my targetsdk is still 22

an-rahulpandey commented 5 years ago

@svereecke Yes, it doesn't work with older target sdk version.This is the if condition which requires target sdk version 26 -

https://github.com/an-rahulpandey/cordova-plugin-dbcopy/blob/master/src/android/DatabaseHelper.java#L41

svereecke commented 5 years ago

but this build failes if the targetversion is lower : /project/src/me/rahul/plugins/sqlDB/DatabaseHelper.java:41: error: cannot find symbol if(Build.VERSION.SDK_INT > android.os.Build.VERSION_CODES.O) {

? is there another workaround except using an older version of the plugin ?

an-rahulpandey commented 5 years ago

install the plugin using Github url, I have updated the code to use constant value 26

svereecke commented 5 years ago

thanks , that works