souvik-ghosh / react-native-create-thumbnail

iOS/Android thumbnail generator with support for both local and remote videos
MIT License
248 stars 104 forks source link

package org.apache.commons.io.comparator does not exist #29

Closed Bayramito closed 3 years ago

Bayramito commented 3 years ago

I get this error when i try to build my app.

******\node_modules\react-native-create-thumbnail\android\src\main\java\com\createthumbnail\CreateThumbnailModule.java:27: error: package org.apache.commons.io.comparator does not exist import org.apache.commons.io.comparator.LastModifiedFileComparator; ^ ****\node_modules\react-native-create-thumbnail\android\src\main\java\com\createthumbnail\CreateThumbnailModule.java:94: error: cannot find symbol Arrays.sort(files, LastModifiedFileComparator.LASTMODIFIED_COMPARATOR); ^ symbol: variable LastModifiedFileComparator location: class CreateThumbnailModule Note: ****\node_modules\react-native-create-thumbnail\android\src\main\java\com\createthumbnail\CreateThumbnailModule.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. 2 errors

"react-native": "^0.62.2", "react-native-create-thumbnail": "^1.2.1"

vikmanatusEurelis commented 3 years ago

Hello,

I am also facing the same issue only on Android build. IOS build is working fine.

Environnement: react-native: ^0.63.3, react-native-create-thumbnail:^1.2.1

Would anyone have a suggestion on how this issue could be fixed for Android ?

Any help would be appreciated :)

Thank you very much

riyan10dec commented 3 years ago

Hello,

Me too having the same problem

Env: "react-native": "0.61.5", react-native-create-thumbnail:^1.2.1

any suggestion for workaround?

boldwade commented 3 years ago

Appears to be a dependency problem with commons-io

geek-ibrar commented 3 years ago

In ~/react-native-create-thumbnail/android/build.gradle change implementation 'commons-io:commons-io:+' to implementation 'commons-io:commons-io:2.8.0'

boldwade commented 3 years ago

In ~/react-native-create-thumbnail/android/build.gradle change implementation 'commons-io:commons-io:+' to implementation 'commons-io:commons-io:2.8.0'

2.8 didn't work for me, I had to use 2.7... I have an open PR https://github.com/souvik-ghosh/react-native-create-thumbnail/pull/30

jjhampton commented 3 years ago

Thanks for the quick work @boldwade - hopefully maintainers can get that reviewed/merged soon. Preventing all Android builds on CI servers without that.

FernandesTeu commented 3 years ago

In ~/react-native-create-thumbnail/android/build.gradle change implementation 'commons-io:commons-io:+' to implementation 'commons-io:commons-io:2.8.0'

worked for me! Thanks @geek-ibrar

cedancp commented 3 years ago

In ~/react-native-create-thumbnail/android/build.gradle change implementation 'commons-io:commons-io:+' to implementation 'commons-io:commons-io:2.8.0'

This also worked for me @geek-ibrar

boldwade commented 3 years ago

You're right @geek-ibrar , not sure why my initial 2.8 draft didn't work... but yep it does actually.

riyan10dec commented 3 years ago

In ~/react-native-create-thumbnail/android/build.gradle change implementation 'commons-io:commons-io:+' to implementation 'commons-io:commons-io:2.8.0'

thanks bro. it's worked

rkaartikeyan commented 3 years ago

@jjhampton we have done this workaround for CI CD.

// RNCreateThumbLibFix.js
var fs = require('fs');
(function () {
  const inputFile = `./node_modules/react-native-create-thumbnail/android/build.gradle`;
  fs.readFile(inputFile, 'utf8', function (err, data) {
    if (err) {
      return console.log(err);
    }
    var currentData = data;
    var newData =
      !!currentData &&
      currentData.replace(
        'commons-io:commons-io:+',
        'commons-io:commons-io:2.8.0',
      );
    fs.writeFile(inputFile, newData, 'utf8', function (err) {
      if (err) return console.log(err);
    });
  });
})();
// package.json
"version": "1.0.1",
  "private": true,
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "start": "react-native start",
    "update:RNCreateThumbLibFix": "node RNCreateThumbLibFix",
    "postinstall": "npm run update:RNCreateThumbLibFix;"
  },
Bayramito commented 3 years ago

In ~/react-native-create-thumbnail/android/build.gradle change implementation 'commons-io:commons-io:+' to implementation 'commons-io:commons-io:2.8.0'

Thanks its worked

souvik-ghosh commented 3 years ago

Thanks, guys! v1.2.2 has been released with the fix.