Flutterfire firebase_auth does not work anymore - android

I am building an application using flutter and flutterfire (which allows me to use flutter and firebase). With flutterfire I am using firebase_auth. I stopped development for a few weeks and came back to my app not working. I narrowed the issues down to it being my firebase_auth not working. In order to test this, I created a brand new firebase app on Android Studios and tried to connect it to flutterfire. I did all the necessary steps to do this and decided to first test cloud_firestore to see if it would work. It did. As soon as I added the line for firebase_auth in my pubspec.yaml file my app would not even build. The errors I get are below. I have tested previous versions of flutter_fire as well.
D8: Cannot fit requested classes in a single dex file. Try supplying a
main-dex list.
methods: 65968 > 65536
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
> com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives: /Users/nolan/Documents/development/lp_2/lp_2/build/app/intermediates/transforms/dexBuilder/debug/5.jar, /Users/nolan/Documents/development/lp_2/lp_2/build/app/intermediates/transforms/dexBuilder/debug/6.jar, /Users/nolan/Documents/development/lp_2/lp_2/build/app/intermediates/transforms/dexBuilder/debug/7.jar, /Users/nolan/Documents/development/lp_2/lp_2/build/app/intermediates/transforms/dexBuilder/debug/8.jar, /Users/nolan/Documents/development/lp_2/lp_2/build/app/intermediates/transforms/dexBuilder/debug/9.jar, /Users/nolan/Documents/development/lp_2/lp_2/build/app/intermediates/transforms/dexBuilder/debug/303.jar, /Users/nolan/Documents/development/lp_2/lp_2/build/app/intermediates/transforms/dexBuilder/debug/304.jar, /Users/nolan/Documents/development/lp_2/lp_2/build/app/intermediates/transforms/dexBuilder/debug/305.jar, /Users/nolan/Documents/development/lp_2/lp_2/build/app/intermediates/transforms/dexBuilder/debug/306.jar, /Users/nolan/Documents/development/lp_2/lp_2/build/app/intermediates/transforms/dexBuilder/debug/307.jar, /Users/nolan/Documents/development/lp_2/lp_2/build/app/intermediates/transforms/dexBuilder/debug/308.jar, /Users/nolan/Documents/development/lp_2/lp_2/build/app/intermediates/transforms/dexBuilder/debug/309.jar, /Users/nolan/Documents/development/lp_2/lp_2/build/app/intermediates/transforms/dexBuilder/debug/310.jar, /Users/nolan/Documents/development/lp_2/lp_2/build/app/intermediates/transforms/dexBuilder/debug/311.jar, /Users/nolan/Documents/development/lp_2/lp_2/build/app/intermediates/transforms/dexBuilder/debug/312.jar, /Users/nolan/Documents/development/lp_2/lp_2/build/app/intermediates/transforms/dexBuilder/debug/313.jar, /Users/nolan/Documents/development/lp_2/lp_2/build/app/intermediates/transforms/dexBuilder/debug/314.jar, /Users/nolan/Documents/development/lp_2/lp_2/build/app/intermediates/transforms/dexBuilder/debug/315.jar, /Users/nolan/Documents/development/lp_2/lp_2/build/app/intermediates/transforms/dexBuilder/debug/316.jar, /Users/nolan/Documents/development/lp_2/lp_2/build/app/intermediates/transforms/dexBuilder/debug/317.jar, /Users/nolan/Documents/development/lp_2/lp_2/build/app/intermediates/transforms/dexBuilder/debug/318.jar, /Users/nolan/Documents/development/lp_2/lp_2/build/app/intermediates/transforms/dexBuilder/debug/319.jar, /Users/nolan/Documents/development/lp_2/lp_2/build/app/intermediates/transforms/dexBuilder/debug/320.jar, /Users/nolan/Documents/development/lp_2/lp_2/build/app/intermediates/transforms/dexBuilder/debug/321.jar, /Users/nolan/Documents/development/lp_2/lp_2/build/app/intermediates/transforms/dexBuilder/debug/322.jar, /Users/nolan/Documents/development/lp_2/lp_2/build/app/intermediates/transforms/dexBuilder/debug/323.jar, /Users/nolan/Documents/development/lp_2/lp_2/build/app/intermediates/transforms/dexBuilder/debug/324.jar, /Users/nolan/Documents/development/lp_2/lp_2/build/app/intermediates/transforms/dexBuilder/debug/325.jar, /Users/nolan/Documents/development/lp_2/lp_2/build/app/intermediates/transforms/dexBuilder/debug/326.jar, /Users/nolan/Documents/development/lp_2/lp_2/build/app/intermediates/transforms/dexBuilder/debug/327.jar, /Users/nolan/Documents/development/lp_2/lp_2/build/app/intermediates/transforms/dexBuilder/debug/328.jar, /Users/nolan/Documents/development/lp_2/lp_2/build/app/intermediates/transforms/dexBuilder/debug/329.jar, /Users/nolan/Documents/development/lp_2/lp_2/build/app/intermediates/transforms/dexBuilder/debug/330.jar, /Users/nolan/Documents/development/lp_2/lp_2/build/app/intermediates/transforms/dexBuilder/debug/331.jar, /Users/nolan/Documents/development/lp_2/lp_2/build/app/intermediates/transforms/dexBuilder/debug/332.jar, /Users/nolan/Documents/development/lp_2/lp_2/build/app/intermediates/transforms/dexBuilder/debug/333.jar, /Users/nolan/Documents/development/lp_2/lp_2/build/app/intermediates/transforms/dexBuilder/debug/334.jar, /Users/nolan/Documents/development/lp_2/lp_2/build/app/intermediates/transforms/dexBuilder/debug/335.jar, /Users/nolan/Documents/development/lp_2/lp_2/build/app/intermediates/transforms/dexBuilder/debug/336.jar, /Users/nolan/Documents/development/lp_2/lp_2/build/app/intermediates/transforms/dexBuilder/debug/337.jar, /Users/nolan/Documents/development/lp_2/lp_2/build/app/intermediates/transforms/dexBuilder/debug/338.jar, /Users/nolan/Documents/development/lp_2/lp_2/build/app/intermediates/transforms/dexBuilder/debug/339.jar, /Users/nolan/Documents/development/lp_2/lp_2/build/app/intermediates/transforms/dexBuilder/debug/340.jar, /Users/nolan/Documents/development/lp_2/lp_2/build/app/intermediates/transforms/dexBuilder/debug/341.jar, /Users/nolan/Documents/development/lp_2/lp_2/build/app/intermediates/transforms/dexBuilder/debug/342.jar, /Users/nolan/Documents/development/lp_2/lp_2/build/app/intermediates/transforms/dexBuilder/debug/343.jar, /Users/nolan/Documents/development/lp_2/lp_2/build/app/intermediates/transforms/dexBuilder/debug/384.jar, /Users/nolan/Documents/development/lp_2/lp_2/build/app/intermediates/transforms/dexBuilder/debug/390.jar, /Users/nolan/Documents/development/lp_2/lp_2/build/app/intermediates/transforms/dexBuilder/debug/396.jar
The number of method references in a .dex file cannot exceed 64K.
Learn how to resolve this issue at
https://developer.android.com/tools/building/multidex.html
* 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
BUILD FAILED in 2s
Finished with error: Gradle build failed: 1

The problem looks more Android related and not iOS or Flutter.
If your minSdkVersion is set to 21 or higher, all you need to do is set multiDexEnabled to true in your module-level build.gradle file, as shown here:
android {
defaultConfig {
...
minSdkVersion 21
targetSdkVersion 26
multiDexEnabled true
}
...
}
More info: https://developer.android.com/studio/build/multidex especially if minSdkVersion < 21

Related

AndroidManifest.xml error, how can I solve this problem?

Overlay manifest:package attribute declared at AndroidManifest.xml:2:5-37 value=(com.app.app)
has a different value=(com.app.app) declared in main manifest at AndroidManifest.xml:2:5-34
Suggestion: remove the overlay declaration at AndroidManifest.xml and place it in the build.gradle:
flavorName {
applicationId = "com.app.app"
}
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:processDebugMainManifest'.
Manifest merger failed : Overlay manifest:package attribute declared at AndroidManifest.xml:2:5-37 value=(com.app.app)
has a different value=(com.app.app) declared in main manifest at AndroidManifest.xml:2:5-34
Suggestion: remove the overlay declaration at AndroidManifest.xml and place it in the build.gradle:
flavorName {
applicationId = "com.app.app"
}
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
BUILD FAILED in 4m 44s
Exception: Gradle task assembleDebug failed with exit code 1
How i can fix this problem?
Try to search them and change your package name in the following locations:
1.) src/profile/AndroidManifest.xml
2.) src/debug/AndroidManifest.xml
3.) src/main/AdroidManifest.xml
4.)
build.gradle .
defaultConfig {
applicationId
5.) MainActivity.java on "package"
If you want to know exactly how to achieve that, take a look at this page for further support.
The best solution to this is by changing the package name in all these 5 files.
1.) android/app/src/debug/AndroidManifest.xml
2.) android/app/src/main/AndroidManifest.xml
3.) android/app/src/profile/AdroidManifest.xml
4.) buildgradle file defaultConfig {applicationId: ""}
5.) MainActivity.java on "package" OR MainActivity.kotlin
After modifying the above files, the Flutter App run seamlessly any issues.

Flutter Image Picker package is not working

I am using image_picker 0.5.2 package for uploading a picture, after I added that dependency into the project I am unable to build my project, getting an exception which is mentioned below. Please help me out.
D8: Program type already present: android.support.v4.os.ResultReceiver$MyResultReceiver
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
> com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives: /Users/harshavardhan/Workspace/cargill_flutter/build/app/intermediates/transforms/dexBuilder/debug/2.jar, /Users/harshavardhan/Workspace/cargill_flutter/build/app/intermediates/transforms/dexBuilder/debug/3.jar, /Users/harshavardhan/Workspace/cargill_flutter/build/app/intermediates/transforms/dexBuilder/debug/4.jar, /Users/harshavardhan/Workspace/cargill_flutter/build/app/intermediates/transforms/dexBuilder/debug/5.jar, /Users/harshavardhan/Workspace/cargill_flutter/build/app/intermediates/transforms/dexBuilder/debug/6.jar, /Users/harshavardhan/Workspace/cargill_flutter/build/app/intermediates/transforms/dexBuilder/debug/7.jar, /Users/harshavardhan/Workspace/cargill_flutter/build/app/intermediates/transforms/dexBuilder/debug/8.jar, /Users/harshavardhan/Workspace/cargill_flutter/build/app/intermediates/transforms/dexBuilder/debug/9.jar, /Users/harshavardhan/Workspace/cargill_flutter/build/app/intermediates/transforms/dexBuilder/debug/10.jar, /Users/harshavardhan/Workspace/cargill_flutter/build/app/intermediates/transforms/dexBuilder/debug/11.jar, /Users/harshavardhan/Workspace/cargill_flutter/build/app/intermediates/transforms/dexBuilder/debug/12.jar, /Users/harshavardhan/Workspace/cargill_flutter/build/app/intermediates/transforms/dexBuilder/debug/13.jar, /Users/harshavardhan/Workspace/cargill_flutter/build/app/intermediates/transforms/dexBuilder/debug/14.jar, /Users/harshavardhan/Workspace/cargill_flutter/build/app/intermediates/transforms/dexBuilder/debug/15.jar, /Users/harshavardhan/Workspace/cargill_flutter/build/app/intermediates/transforms/dexBuilder/debug/16.jar, /Users/harshavardhan/Workspace/cargill_flutter/build/app/intermediates/transforms/dexBuilder/debug/17.jar, /Users/harshavardhan/Workspace/cargill_flutter/build/app/intermediates/transforms/dexBuilder/debug/18.jar, /Users/harshavardhan/Workspace/cargill_flutter/build/app/intermediates/transforms/dexBuilder/debug/19.jar, /Users/harshavardhan/Workspace/cargill_flutter/build/app/intermediates/transforms/dexBuilder/debug/20.jar, /Users/harshavardhan/Workspace/cargill_flutter/build/app/intermediates/transforms/dexBuilder/debug/21.jar, /Users/harshavardhan/Workspace/cargill_flutter/build/app/intermediates/transforms/dexBuilder/debug/22.jar, /Users/harshavardhan/Workspace/cargill_flutter/build/app/intermediates/transforms/dexBuilder/debug/23.jar, /Users/harshavardhan/Workspace/cargill_flutter/build/app/intermediates/transforms/dexBuilder/debug/24.jar, /Users/harshavardhan/Workspace/cargill_flutter/build/app/intermediates/transforms/dexBuilder/debug/25.jar, /Users/harshavardhan/Workspace/cargill_flutter/build/app/intermediates/transforms/dexBuilder/debug/26.jar, /Users/harshavardhan/Workspace/cargill_flutter/build/app/intermediates/transforms/dexBuilder/debug/27.jar, /Users/harshavardhan/Workspace/cargill_flutter/build/app/intermediates/transforms/dexBuilder/debug/28.jar, /Users/harshavardhan/Workspace/cargill_flutter/build/app/intermediates/transforms/dexBuilder/debug/29.jar, /Users/harshavardhan/Workspace/cargill_flutter/build/app/intermediates/transforms/dexBuilder/debug/30.jar, /Users/harshavardhan/Workspace/cargill_flutter/build/app/intermediates/transforms/dexBuilder/debug/31.jar, /Users/harshavardhan/Workspace/cargill_flutter/build/app/intermediates/transforms/dexBuilder/debug/32.jar, /Users/harshavardhan/Workspace/cargill_flutter/build/app/intermediates/transforms/dexBuilder/debug/33.jar, /Users/harshavardhan/Workspace/cargill_flutter/build/app/intermediates/transforms/dexBuilder/debug/34.jar, /Users/harshavardhan/Workspace/cargill_flutter/build/app/intermediates/transforms/dexBuilder/debug/35.jar, /Users/harshavardhan/Workspace/cargill_flutter/build/app/intermediates/transforms/dexBuilder/debug/36.jar, /Users/harshavardhan/Workspace/cargill_flutter/build/app/intermediates/transforms/dexBuilder/debug/37.jar, /Users/harshavardhan/Workspace/cargill_flutter/build/app/intermediates/transforms/dexBuilder/debug/38.jar, /Users/harshavardhan/Workspace/cargill_flutter/build/app/intermediates/transforms/dexBuilder/debug/39.jar, /Users/harshavardhan/Workspace/cargill_flutter/build/app/intermediates/transforms/dexBuilder/debug/40.jar, /Users/harshavardhan/Workspace/cargill_flutter/build/app/intermediates/transforms/dexBuilder/debug/41.jar, /Users/harshavardhan/Workspace/cargill_flutter/build/app/intermediates/transforms/dexBuilder/debug/42.jar, /Users/harshavardhan/Workspace/cargill_flutter/build/app/intermediates/transforms/dexBuilder/debug/43.jar, /Users/harshavardhan/Workspace/cargill_flutter/build/app/intermediates/transforms/dexBuilder/debug/44.jar, /Users/harshavardhan/Workspace/cargill_flutter/build/app/intermediates/transforms/dexBuilder/debug/45.jar, /Users/harshavardhan/Workspace/cargill_flutter/build/app/intermediates/transforms/dexBuilder/debug/46.jar
Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes.
Program type already present: android.support.v4.os.ResultReceiver$MyResultReceiver
* 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
BUILD FAILED in 22s
*******************************************************************************************
The Gradle failure may have been because of AndroidX incompatibilities in this Flutter app.
*******************************************************************************************
Gradle task assembleDebug failed with exit code 1
Exited (sigterm)
The Gradle failure may have been because of AndroidX incompatibilities in this Flutter app.
As mentioned in your trace, this error is because of AndroidX incompatibilities in your app. The image_picker plugin migrated to the latest AndroidX support libraries from version 0.5.0.
For your app to work, you can either migrate your app to AndroidX, or if your app depends on any other package which has not been migrated to AndroidX yet, you can lock your image_picker plugin version to 0.4.12+1, which uses the older support libraries.
Add this to your pubspec.yaml to use specific version of this plugin -
image_picker: 0.4.12+1
More about this here.
UPDATE
You can check this answer for an explanation about why migrate to AndroidX. Also, this official blog explains everything regarding AndroidX.
Hope this helps!
You need to migrate to AndroidX for that particular version of the library to work.
Follow the steps in this link to go ahead with the migration.
File _image;
final images=ImagePicker();
Future getImage()async {
var Image=await images.getImage(source: ImageSource.camera);
setState(() {
_image=File(Image.path);
}); }
and when you want to Use the
_image which stored the image path:
Container(
height: 180,
width: 180,
child: ClipRRect(child: _image==null?Center(child: Text('Please Upload a pic'),):Image.file(_image,fit: BoxFit.fill,),),
when you initially run the program the _image variable is not containing the image path actually the path is empty or null and the error appears so do
_image==null?Center(child: Text('Please Upload a pic'),):
it tells flutter if the path is null and not chossed show my manual message
you will see Please upload a pic in the container when you choose the image the File(Image.path); will generate an appropriate path and your pic will appear, thankyou,

Could not download groovy-all.jar (org.codehaus.groovy:groovy-all:2.4.15) in Android Studio 3.3 Beta 2

The Problem:
when i am trying to build release variant of my Kotlin project in Android Studio 3.3 Beta 2, it is getting stuck randomly for 10 to 16 minutes after spitting some errors.
Running gradle/assemble it showed following errors :
> Task :app:lintVitalRelease FAILED
:app:lintVitalRelease (Thread[Task worker for ':' Thread 2,5,main]) completed. Took 8 mins 23.222 secs.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:lintVitalRelease'.
> Could not resolve all files for configuration ':app:lintClassPath'.
> Could not download groovy-all.jar (org.codehaus.groovy:groovy-all:2.4.15)
> Could not get resource 'https://jcenter.bintray.com/org/codehaus/groovy/groovy-all/2.4.15/groovy-all-2.4.15.jar'.
> Connection reset
* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:lintVitalRelease'.
What I've tried so far
Answer from this question Could not find org.codehaus.groovy:groovy-all:2.4.12
but it isn't downloading at all and getting stuck.
tried to open the link in the browser and it is downloading the file but it is not downloading while in the build process https://jcenter.bintray.com/org/codehaus/groovy/groovy-all/2.4.15/groovy-all-2.4.15.jar
created a brand new project tried to release it same problem there
Project Gradle settings
android.useAndroidX=true
# Automatically convert third-party libraries to use AndroidX
android.enableJetifier=true
# Kotlin code style for this project: "official" or "obsolete":
kotlin.code.style=official
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.0"
classpath 'com.android.tools.build:gradle:3.4.0-alpha02'
//workaround for Dagger2 > 2.16
classpath 'com.android.tools.build.jetifier:jetifier-processor:1.0.0-beta02'
i don't know what is causing it to stop downloading or not allowing it to download the groovy file but i am stuck here and can't release my app :(
when i updated my Android Studio to ver3.3 today ,i met this problem ,and here are my errors:
"Execution failed for task ':app:lintVitalRelease"....
"org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ArtifactResolveException: Could not resolve all artifacts for configuration ':app:debugAndroidTestRuntimeClasspath"
.....
"Could not download junit.jar (junit:junit:4.12)"
.....
"org.gradle.api.resources.ResourceException: Could not get resource 'https://jcenter.bintray.com/junit/junit/4.12/junit-4.12.jar'."
.....
"org.gradle.internal.resource.transport.http.HttpRequestException: Could not GET 'https://jcenter.bintray.com/junit/junit/4.12/junit-4.12.jar'"
.....
this time its 'junit.jar',and 30mins ago its 'groovy-all.jar'....ithink there are sth wrong with my internet,so i have tried many times and waited for hours...
but when i searched 'Execution failed for task ':app:lintVitalRelease' when i was waiting ,i found another solution,add the following lines to android{} in app\build.gradle
"lintOptions {
checkReleaseBuilds false
abortOnError false
}"
i dont know why,but it works,the red lines disappear...
I solved it by waiting for 30 minutes so it can download the groovy jar file, before trying it for 2 hours and it was no problem with my internet.
thanks #TheWanderer to hint me about the internet
Accepted answer is right, just one more thing. For me I was using VPN as I was connected to database via secure channel. Hence, when I was running android studio, it was failing at similar point. Once I turned off my vpn and ran again it worked like a charm...

Error when installing FirebaseAuth.unitypackage, Gradle failed to fetch dependencies

I installed the google json to my project, and the FirebaseAuth.unitypackage, aswell. While the Firebase.Auth.unitypackage was being added the console displayed "Gradle failed to fetch dependencies". I updated my play services resolver to 1.2.50.00 by deleting the previous one and imported the new one into my project as another post said but no fix. I also tried /Assets/PlayServicesResolver/Resolve and Force resolve.
The console logs:
Gradle failed to fetch dependencies.
Failed to run 'Temp\PlayServicesResolverGradle\gradlew.bat -b Temp\PlayServicesResolverGradle\PlayServicesResolver.scripts.download_artifacts.gradle "-PANDROID_HOME=C:/Users/Augmented Marketing/Downloads/android-sdk_r24.4.1-windows/android-sdk-windows" "-PTARGET_DIR=C:\Users\Augmented Marketing\Documents\Unity firebase test\Assets\Plugins\Android" "-PMAVEN_REPOS=file:///C:/Users/Augmented Marketing/Documents/Unity firebase test/Assets/Firebase/m2repository" "-PPACKAGES_TO_COPY=com.google.android.gms:play-services-base:11.2.0;com.google.firebase:firebase-common:11.2.0;com.google.firebase:firebase-core:11.2.0;com.google.firebase:firebase-app-unity:4.1.0;com.google.firebase:firebase-auth:11.2.0;com.google.firebase:firebase-auth-unity:4.1.0"'
stdout:
BUILD FAILED
Total time: 1.315 secs
stderr:
FAILURE: Build failed with an exception.
* Where:
Build file 'C:\Users\Augmented Marketing\Documents\Unity firebase test\Temp\PlayServicesResolverGradle\PlayServicesResolver.scripts.download_artifacts.gradle' line: 129
* What went wrong:
A problem occurred evaluating root project 'PlayServicesResolverGradle'.
> Illegal character in path at index 26: file:///C:/Users/Augmented Marketing/Documents/Unity firebase test/Assets/Firebase/m2repository
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
exit code: 1
UnityEngine.Debug:LogError(Object)
GooglePlayServices.PlayServicesResolver:<PlayServicesResolver>m__0(String, LogLevel)
Google.JarResolver.PlayServicesSupport:Log(String, LogLevel, Boolean)
GooglePlayServices.<GradleResolution>c__AnonStorey0:<>m__0(Result)
GooglePlayServices.<GradleResolution>c__AnonStorey1:<>m__0()
GooglePlayServices.PlayServicesResolver:PumpUpdateQueue()
UnityEditor.EditorApplication:Internal_CallUpdateFunctions()
Can you try change the folder name Unityfirebasetest instead of Unity firebase test and AugmentedMarketing instead of Augmented Marketing in C:\Users\Augmented Marketing\Documents\Unity firebase test ?
So, remove the blanks.
I believe the issue is whitespace in your project path. We fixed this in the 4.2.0 release of the Firebase SDK https://firebase.google.com/support/release-notes/unity#4.2.0 and in https://github.com/googlesamples/unity-jar-resolver/commit/bf515eb2080ee9713584684521d36ad7e8d62fbd of the Play Services Resolver.
Cheers,
Stewart

why i get Some file crunching failed after i rename drawable file to .9.png?

I am testing 9-patch image .
Before everything works fine , and i rename drawable file ic_button_beat_box_default.png to ic_button_beat_box_default.9.png , then i get error :
Some file crunching failed, see logs for details
. Then i rename back , it works normal. So how this happens ?
The complete error is :
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:mergeDebugResources'.
> Some file crunching failed, see logs for details
* Try:
Run with --info or --debug option to get more log output.
* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:mergeDebugResources'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:69)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46)
at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:35)
...
Caused by: java.lang.RuntimeException: Some file crunching failed, see logs for details
at com.android.builder.png.QueuedCruncher.waitForAll(QueuedCruncher.java:260)
at com.android.builder.png.QueuedCruncher.end(QueuedCruncher.java:280)
at com.android.ide.common.res2.MergedResourceWriter.end(MergedResourceWriter.java:132)
at com.android.ide.common.res2.DataMerger.mergeData(DataMerger.java:291)
at com.android.ide.common.res2.ResourceMerger.mergeData(ResourceMerger.java:48)
at com.android.build.gradle.tasks.MergeResources.doIncrementalTaskAction(MergeResources.java:250)
at com.android.build.gradle.internal.tasks.IncrementalTask.taskAction(IncrementalTask.java:124)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:75)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$IncrementalTaskAction.doExecute(AnnotationProcessingTaskFactory.java:244)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:220)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$IncrementalTaskAction.execute(AnnotationProcessingTaskFactory.java:231)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:209)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)
... 57 more
On Windows I had a "BUILD FAILED Failed to crunch file [path]" error and solved it by closing the Android Studio project, copying the entire project folder into a location with a shorter directory path, such as my C: folder and then opening the project in the new location. Hope it helps
Rename your file again
ic_button_beat_box_default.9.png to ic_button_beat_box_default9.png because android studio takes ic_button_beat_box_default.9 instead of ic_button_beat_box_default.9.png
or another solution is add below line to your build.gradle(Module:app)
android{
aaptOptions {cruncherEnabled = false}
}
I had the same issue by changing only file name, when I saved the image in 9-patch-tool issue solved.
I had the same issue. I was able to resolve it just by reducing one folder from chain. It is due to long file path. So try using minimum hierarchy for your project location.
try this, insert this code in android section in app gradle:
aaptOptions {
cruncherEnabled = false
}
I have red other similar questions and answers to them on SO, regarding that "file crunching failed, see logs for details" error.
Nothing helped.So,I reverted all "SO" changes I made with gradle and other files
and removed ".9" in that png.9 files and it began work.
Then I recreated all *.9.png files again.
Hence, in my case the cause was wrong editing of 9.pngs in external png editors.
What solved it for me was to set
aaptOptions {
cruncherEnabled = false
}
Then to run the app (icons were missing)
then remove this option and run the app again.
Hope it helps somebody.
This worked for me:
Build -> Clean Project.
and then
Build -> Rebuild Project.

Categories

Resources