Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build failing (Unknown property ANDROID_EXIFINTERFACES_VERSION) #46

Open
ddoria921 opened this issue Jun 12, 2018 · 18 comments
Open

Build failing (Unknown property ANDROID_EXIFINTERFACES_VERSION) #46

ddoria921 opened this issue Jun 12, 2018 · 18 comments

Comments

@ddoria921
Copy link

My builds started failing after the latest changes to the plugin.xml file. I'm getting this error

A problem occurred evaluating root project 'android'.
> Could not get unknown property 'ANDROID_EXIFINTERFACES_VERSION' for object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

After looking at where the build is failing it pointed me to my build.gradle file. It's failing here

dependencies {
    compile fileTree(dir: 'libs', include: '*.jar')
    // SUB-PROJECT DEPENDENCIES START
    debugCompile(project(path: "CordovaLib", configuration: "debug"))
    releaseCompile(project(path: "CordovaLib", configuration: "release"))
    compile "com.android.support:support-v4:24.1.1+"
    compile "com.android.support:exifinterface:$ANDROID_EXIFINTERFACES_VERSION" 
// FAILS HERE ^^ 
    // SUB-PROJECT DEPENDENCIES END
}

It looks like the variable ANDROID_EXIFINTERFACES_VERSION isn't getting properly replaced in the build.gradle file. Any idea why this is happening?

@ddoria921 ddoria921 changed the title Build failing Build failing (Unknown property ANDROID_EXIFINTERFACES_VERSION) Jun 12, 2018
@JoschkaSchulz
Copy link
Owner

@keyz182, maybe you could have an idea with that problem?

@keyz182
Copy link
Contributor

keyz182 commented Jun 12, 2018

@ddoria921 can you try modifying your config.xml to

 <plugin name="cordova-plugin-image-resizer" spec="https://github.com/JoschkaSchulz/cordova-plugin-image-resizer.git" >
    <variable name="ANDROID_EXIFINTERFACES_VERSION" value="27.+" />
</plugin>

It should be setting a default, bit maybe it's being missed?

Typed that on mobile while on the move btw, so be sure to check I got the syntax right.

@ddoria921
Copy link
Author

Nope that didn't fix it.

@keyz182
Copy link
Contributor

keyz182 commented Jun 12, 2018 via email

@ddoria921
Copy link
Author

ddoria921 commented Jun 12, 2018

The build is failing for me on our build server. Every time I run a build it does a fresh install of the android platform and all the plugins.

When I try to reproduce it locally on my machine I don't get the error. It installs the plugin and builds fine with the proper ANDROID_EXIFINTERFACES_VERSION in the build.gradle file. On my co-worker's machine it fails the same way it does on the build server so I'm not sure what the issue is...

I've tried several different things on my local machine (where all the development happens) to reproduce the issue like:

  • Clearing out all platforms (cordova platform remove android)
  • Clearing out all plugins (rm -rf cordova/plugins/*)
  • rm -rf cordova/node_modules
  • rm -f cordova/package.json cordova/package-lock.json
  • cordova platform add android

In the end it's worked every time on my computer. But still nothing on the build server or my co-worker's machine.

I removed the plugin and had to revert to this commit to get it working. One thing that would help in the meantime is if this plugin had tagged releases that I could point to so I don't have to use the commit hash.

EDIT: fixing grammar

@JoschkaSchulz
Copy link
Owner

JoschkaSchulz commented Jun 12, 2018

yeah strange... I tried it on my machine too right now... and don't get any errors... everything is working fine. Could it be a problem with the gradle version maybe? I tried it on gradle 4.8 on a mac with the jdk 1.8... I will search around a bit... maybe I find a clue

@keyz182
Copy link
Contributor

keyz182 commented Jun 14, 2018

I've not been able to recreate or figure out anything potentially wrong I'm afraid. It looks like other plugins use this same method. I don't think it's an issue with gradle, as the variable should be substituted in before gradle is run (as far as I can tell).

@JoschkaSchulz would you be averse to uploading your plugin to NPM? We could pin to versions then that you upload at least.

@ddoria921
Copy link
Author

I also don't think it's an issue with gradle because the variable should be swapped in before it gets to gradle. Also, you don't necessarily have to upload to NPM. You can tag and generate release through GitHub that would allow you to install the plugin at a specific version.

For example to install v1.0 would look like this:
cordova plugin add https://github.com/protonet/cordova-plugin-image-resizer.git#1.0

@huytran0605
Copy link

huytran0605 commented Jun 20, 2018

i got same problem. How can i get old version ?
btw, I'm using cordova-android 6.4 with Android target 26.

@JoschkaSchulz
Copy link
Owner

I would like to get more information for that... it's really hard to reproduce this error so I can't help. You can just get an older version by removing that code... I have to do an upload to npm of versions that this makes not so much problems in the future again... but for now there is no version tagging

@huytran0605
Copy link

huytran0605 commented Jun 20, 2018

Could you tell me know required package to install current version of this plugin?
Because i saw it need to have exifinterface version > 27? My machine only has 25.1.0 in android-sdk folder.

And I force to update project.properties
cordova.system.library.5=com.android.support:exifinterface:25.1.0
It can build success. But does it makes some bug?

@keyz182
Copy link
Contributor

keyz182 commented Jun 20, 2018

@huytran0605 I believe anything after or including 25.1.0 will work, but I've not tested. The exifinterface was added in 25.1.0, so won't work on anything earlier.

@huytran0605
Copy link

@keyz182 Unfortunately, I tested and It cannot work :(

@huytran0605
Copy link

@JoschkaSchulz Could you please upload version tagging? Because i use CI to build app so it difficult to install the plugin by manual?
Thanks. I really like and want to use this plugin anymore.

@JoschkaSchulz
Copy link
Owner

Hey, I added version tagging here on github and also uploaded to https://www.npmjs.com/package/cordova-plugin-simple-image-resizer ... sadly the name was already taken that's the reason why I add the (stupid word) simple in it

@huytran0605
Copy link

huytran0605 commented Aug 13, 2018

Do you have any idea why in file platforms/android/project.properties used ANDROID_EXIFINTERFACES_VERSION but not exactly any version (25.1.0)
cordova.system.library.2=com.android.support:exifinterface:$ANDROID_EXIFINTERFACES_VERSION

I think in my config it can't read $ANDROID_EXIFINTERFACES_VERSION, so It makes build failed

@sithwarrior
Copy link
Contributor

I spent some time looking at this today.
The problem is that the value replacement for $ANDROID_EXIFINTERFACES_VERSION, dosent work, in older versions of Cordova it seems.
I updated to Cordova 7.1.0 and Cordova-Android 6.4.0 that worked for me.

Another option is to supply the variable at build time, it will then be swaped inside the build.gradle file, and complete the build
cordova build android -- --gradleArg=-PANDROID_EXIFINTERFACES_VERSION=27.+

I created a PR that hardcodes the value to 27.+ #58
That should work, but i dont know, if thats the intended behaviour.

@jetma
Copy link

jetma commented Mar 29, 2019

I used cordova plugin add cordova-plugin-simple-image-resizer instead of cordova plugin add https://github.com/protonet/cordova-plugin-image-resizer.git to add the plugin, it worked fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants