Closed quickcodes closed 1 year ago
do try these commands line by line.
flutter clean
flutter pub get
If issue still persists, delete pubspec.lock
and go to C:\Users\dhruv\.gradle
and delete wrapper
folder.
After deleting wrapper
folder, come back to your project and run these commands one a time
cd android
./gradlew clean
./gradlew build wrapper
flutter clean ; flutter pub get
After passing through all the mentioned steps when I gradlew clean
and gradlew build wrapper
It failed to build. The output is below
> Configure project :app
WARNING:The option 'android.enableR8' is deprecated.
It was removed in version 7.0 of the Android Gradle plugin.
Please remove it from `gradle.properties`.
WARNING:We recommend using a newer Android Gradle plugin to use compileSdk = 33
This Android Gradle plugin (7.2.1) was tested up to compileSdk = 32
This warning can be suppressed by adding
android.suppressUnsupportedCompileSdk=33
to this project's gradle.properties
The build will continue, but you are strongly encouraged to update your project to
use a newer Android Gradle Plugin that has been tested with compileSdk = 33
> Task :app:compileFlutterBuildDebug
../../../../../AppData/Local/Pub/Cache/hosted/pub.dev/printing-5.10.1/lib/src/fonts/font.dart:47:15: Error: 'AssetManifest' is imported from both 'package:flutter/src/services/asset_manifest.dart' and 'package:printing/src/fonts/manifest.dart'.
if (await AssetManifest.contains(asset)) {
^^^^^^^^^^^^^
Target kernel_snapshot failed: Exception
> Task :app:compileFlutterBuildDebug FAILED
FAILURE: Build failed with an exception.
* Where:
Script 'C:\src\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1154
* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'C:\src\flutter\bin\flutter.bat'' finished with non-zero exit value 1
* 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
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
See https://docs.gradle.org/7.4/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 46s
1 actionable task: 1 executed
@quickcodes Please check this and see if it helps in your case.
I tried all the steps of that link. Nothing working :(
I am unable to understand what causing this issue is it Flutter's issue or my project's...??? I am developing app in flutter from more than a year. I never faced any issue like this.
should I reinstall flutter?
Thanks for helping me! issue got solved. I deeply read everything mentioned in error and mention in the link provided upper. and It got solved. I changed file called src/font/font.dart inside my cache with the given file in the link :)
link
Can you explain in more detail?
../../../../../AppData/Local/Pub/Cache/hosted/pub.dev/printing-5.10.1/lib/src/fonts/font.dart
You can find this file by typingfonts/font.dart
in android's studio search section
/*
* Copyright (C) 2017, David PHAM-VAN <dev.nfet.net@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import 'package:flutter/services.dart' as services;
import 'package:pdf/widgets.dart';
import '../cache.dart';
import 'manifest.dart' as manifest;
/// Downloadable font object
class DownloadableFont {
/// Create a downloadable font object
const DownloadableFont(this.url, this.name);
/// The Url to get the font from
final String url;
/// The Font filename
final String name;
/// The cache to use
static var cache = PdfBaseCache.defaultCache;
/// Get the font to use in a Pdf document
Future<Font> getFont({
PdfBaseCache? pdfCache,
bool protect = false,
Map<String, String>? headers,
String assetPrefix = 'google_fonts/',
services.AssetBundle? bundle,
bool cache = true,
}) async {
final asset = '$assetPrefix$name.ttf';
if (await manifest.AssetManifest.contains(asset)) {
bundle ??= services.rootBundle;
final data = await bundle.load(asset);
return TtfFont(
data,
protect: protect,
);
}
pdfCache ??= PdfBaseCache.defaultCache;
try {
final bytes = await pdfCache.resolve(
name: name,
uri: Uri.parse(url),
headers: headers,
cache: cache,
);
return TtfFont(
bytes.buffer.asByteData(bytes.offsetInBytes, bytes.lengthInBytes),
protect: protect,
);
} catch (e) {
assert(() {
// ignore: avoid_print
print('$e\nError loading $name, fallback to Helvetica.');
return true;
}());
return Font.helvetica();
}
}
}
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v
and a minimal reproduction of the issue.
First I am getting this error
And when i solved this error by adding this in my pubspec.yaml file and i alaso added some other dependencies because of conflicts
after adding this i am getting below error
Here is my pubspec.yaml file
The output of flutter doctor -v is here
Please help me to resolve this issue.