Trying to run my app on the emulator but keep getting this error:
e: C:\flutter.pub-cache\hosted\pub.dartlang.org\video_compress-2.0.0\android\src\main\kotlin\com\example\video_compress\VideoCompressPlugin.kt: (25, 7): Redeclaration: VideoCompressPlugin e: C:\flutter.pub-cache\hosted\pub.dartlang.org\video_compress-2.1.0\android\src\main\kotlin\com\example\video_compress\VideoCompressPlugin.kt: (28, 7): Redeclaration: VideoCompressPlugin e: C:\flutter.pub-cache\hosted\pub.dartlang.org\video_compress-2.1.0\android\src\main\kotlin\com\example\video_compress\VideoCompressPlugin.kt: (184, 28): Cannot access '': it is private in 'VideoCompressPlugin' e: C:\flutter.pub-cache\hosted\pub.dartlang.org\video_compress-2.1.0\android\src\main\kotlin\com\example\video_compress\VideoCompressPlugin.kt: (184, 48): No value passed for parameter 'activity' e: C:\flutter.pub-cache\hosted\pub.dartlang.org\video_compress-2.1.0\android\src\main\kotlin\com\example\video_compress\VideoCompressPlugin.kt: (184, 48): No value passed for parameter 'context' e: C:\flutter.pub-cache\hosted\pub.dartlang.org\video_compress-2.1.0\android\src\main\kotlin\com\example\video_compress\VideoCompressPlugin.kt: (184, 48): No value passed for parameter 'channel' e: C:\flutter.pub-cache\hosted\pub.dartlang.org\video_compress-2.1.0\android\src\main\kotlin\com\example\video_compress\VideoCompressPlugin.kt: (185, 22): Unresolved reference: init
FAILURE: Build failed with an exception.
Compilation error. See log for more details
What I have tried so far:
A possible offender?
_submit() async {
if (videoList.isEmpty || outputPath.isEmpty) return;
if (!isLoading) {
setState(() {
isLoading = true;
});
}
print('LOG: outputPath: $outputPath');
var outPutFileExists = await File(outputPath).exists();
print('LOG: output file exists $outPutFileExists');
videoUrl = await StorageService.uploadVideo(File(outputPath));
imageUrl = await StorageService.uploadVideoThumbnail(File(outputPath));
Post post = Post(
imageUrl: imageUrl,
videoUrl: videoUrl,
likeCount: 0,
authorId: Provider.of<UserData>(context).currentUserId,
timestamp: Timestamp.fromDate(DateTime.now()),
viewCount: 0,
mode: 'Beginner',
cardId: widget.card.card[0],
category: widget.card.category,
flagged: false,
flags: []);
Another possibility:
static Future<MediaInfo> compressVideo(File file) async {
final info = await VideoCompress.compressVideo(
file.path,
quality: VideoQuality.HighestQuality,
deleteOrigin: false,
);
return info;
}
Third try:
static Future<String> uploadVideo(File videoFile) async {
String videoId = Uuid().v4();
MediaInfo videoInfo = await compressVideo(videoFile);
StorageUploadTask uploadTask =
storageRef.child('videos/video_$videoId.mp4').putFile(videoInfo.file);
StorageTaskSnapshot storageSnap = await uploadTask.onComplete;
String downloadUrl = await storageSnap.ref.getDownloadURL();
return downloadUrl;
}
static Future<String> uploadVideoThumbnail(File videoFile) async {
String photoId = Uuid().v4();
final thumbnailFile = await VideoCompress.getFileThumbnail(videoFile.path,
quality: 100, // default(100)
position: -1 // default(-1)
);
StorageUploadTask uploadTask = storageRef
.child('images/thumbnails/image_$photoId.jpg')
.putFile(thumbnailFile);
StorageTaskSnapshot storageSnap = await uploadTask.onComplete;
String downloadUrl = await storageSnap.ref.getDownloadURL();
return downloadUrl;
}
Would be very grateful for any guidance.
Tom
I think when you were updating to video_compress v2.1.0, you still had version v2.0.0 cached. Thus, the "Redeclaration" error in the log. You might want to run this in your terminal:
flutter clean && flutter packages get
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With