So im trying to download a file using a given URL using the flutter_downloader package Below is my implementation,
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await FlutterDownloader.initialize(
debug: true // optional: set false to disable printing logs to console
);
runApp(new MaterialApp(
home: new MyApp(),
));
}
class MyApp extends StatefulWidget {
@override
_State createState() => new _State();
}
class _State extends State<MyApp> {
@override
Widget build(BuildContext context) {
return new Scaffold(
appBar: new AppBar(title: Text('Template Code'),backgroundColor:
Colors.green,),
body: Container(
padding: EdgeInsets.all(50.0),
child: Center(child:Column(
children: <Widget> [
Text('Hello World'),
RaisedButton(onPressed: () async {
final status = await Permission.storage.request();
if (status.isGranted) {
final externalDir = await getExternalStorageDirectory();
final id = await FlutterDownloader.enqueue(
url:
"https://sample-videos.com/video123/mp4/720/big_buck_bunny_720p_1mb.mp4",
savedDir: externalDir!.path,
fileName: "download",
showNotification: true,
openFileFromNotification: true,
);
} else {
print("Permission denied");
}
}),
],
)),
),
);
}
}
when I run this on my emulator,I get this exception
FAILURE: Build failed with an exception.
- What went wrong: Execution failed for task ':app:generateDebugBuildConfig'.
Failed to calculate the value of task ':app:generateDebugBuildConfig' property 'buildConfigPackageName'. Failed to query the value of property 'packageName'. > org.xml.sax.SAXParseException; systemId: file:/C:/Users/HP/Desktop/OWASLO/care_giver_app/android/app/src/main/AndroidManifest.xml; lineNumber: 25; columnNumber: 31; The prefix "tools" for attribute "tools:node" associated with an element type "provider" is not bound.
Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
Please help!!!
CodePudding user response:
Check-out this issue thread: https://github.com/flutter/flutter/issues/63114
Basically, steps you can try are:
- Delete Gradle cache at
%USER_HOME%\.gradle/caches/(It'll re-download the Gradle again) - Run
flutter clean - Run
flutter pub get
CodePudding user response:
there is issue with manifest file
this line missing : xmlns:tools="http://schemas.android.com/tools"
in manifest tag
It should be like below.
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="app package name">
