Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

`flutter build apk` should include libflutter.so for both 32bit and 64bit architectures #18494

Open
peace2knowledge opened this issue Jun 15, 2018 · 154 comments

Comments

@peace2knowledge
Copy link

commented Jun 15, 2018

using flutter build apk --release --flavor pro make apk file , but arm64-v8a do not include libflutter.so file.so app launch fail.
when I add --target-platform=android-arm64 : flutter build apk --release --flavor pro --target-platform=android-arm64,apk file include so flie. But app launch fail on 32 bit cpu.
what can i do, apk file can run on 64 and 32 cpu @mravn-google

/System.err(15263): java.lang.UnsatisfiedLinkError: Couldn't load flutter from loader dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.jianzhibao.ka.enterprise-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.jianzhibao.ka.enterprise-1, /vendor/lib, /system/lib]]]: findLibrary returned null

I create new project, debug or releas, work well. diffrece from new project from my project is that i add thrid party so file

image

where is the problem ?

@swavkulinski

This comment has been minimized.

Copy link

commented Jun 21, 2018

AFAIK, currently, Flutter will only add libflutter.so to one selected platform folder in the release APK. The workaround which worked for me was to force build.gradle to do 32bit only (excluding all 64bit libraries + Intel)

release {
        
    ...
            ndk{
                abiFilters "armeabi-v7a"
            }
}
@zoechi

This comment has been minimized.

Copy link
Contributor

commented Jun 22, 2018

cc @Hixie

@jeanpaulcozzatti

This comment has been minimized.

Copy link

commented Jul 1, 2018

@swavkulinski how would you release the to apks to the playstore?

danielfoehrKn added a commit to danielfoehrKn/MediathekViewMobile that referenced this issue Jul 4, 2018

Ffmpeg native android lib included ABIS for x64 and x86 CPU's -> Flut…
…ter recognized x64 ABIS and build the whole project trageting that CPU Architecture. However that caused startup failure on non-x64 CPUS

--> only included the armeabi-v7 instead of all types

- Also APK size shrinked to 50%
See:
flutter/flutter#18494
@kevinvandenbreemen

This comment has been minimized.

Copy link

commented Jul 24, 2018

Similar to #18939

@xxseabxx

This comment has been minimized.

Copy link

commented Jul 26, 2018

Have the same problem - but flutter.so not included in "armeabi-v7a folder.
Has only third party libraries for x86 and armeabi-v7a - but no arm64.
Would like to build flutter only for "armeabi-v7a with
ndk{
abiFilters "armeabi-v7a" // also not work"armeabi", "x86",
}
and set as target-platform as @mravn-google suggest to android-arm.

APK without specify arch and not include libraries
screen shot 2018-07-26 at 21 06 53

APK with libraries and no arm spec
screen shot 2018-07-26 at 21 10 30

APK with specify arch and include libraries
screen shot 2018-07-26 at 21 12 58

Any suggestion how to debug further steps?

@peasfarmer

This comment was marked as off-topic.

Copy link

commented Aug 9, 2018

@xxseabxx i have the same problem

@gurleensethi

This comment has been minimized.

Copy link

commented Aug 13, 2018

I have the same problem, building for 32-bit will exclude 64-bit devices, it runs on them though. Building for 64 by specifying --target-platform android-arm64 works on 64-bit devices, but crashes on 32-bit devices. Also Google will be restricting upload of apks to be 64-bit in 2019.

Flutter Team, please resolve this basic issue!

@dieegov

This comment was marked as off-topic.

Copy link

commented Aug 14, 2018

Flutter Team, please resolve this basic issue!

@bdytx5

This comment has been minimized.

Copy link

commented Aug 30, 2018

So am I wrong by saying that flutter can only support release apk’s for either 32 or 64 bit, but not both?

@jeanpaulcozzatti

This comment was marked as off-topic.

Copy link

commented Sep 13, 2018

any luck here?

@bdytx5

This comment was marked as off-topic.

Copy link

commented Sep 14, 2018

I think xxseabxx's comment might work but I haven't tried it...

@lance-blo

This comment has been minimized.

Copy link

commented Sep 15, 2018

I am also having the same issue.

In all of my dependencies, I isolated at least one package causing the issue, I filled a bug report accordingly: azihsoyn/flutter_mlkit#36

To isolate the problem, for each of my dependency / plugin:

  1. Create an empty flutter project

  2. Replace main.dart with

the package example code (ex: https://pub.dartlang.org/packages/flutter_html_view#-example-tab-)

  1. Update pubspec.yaml accordingly

  2. run

$ flutter build apk

It turned out that the one creating was flutter_mlkit.

I want to be able to target both 32 & 64 architectures.

@cortexuvula

This comment was marked as off-topic.

Copy link

commented Sep 27, 2018

Have the same issue. --target-platform=android-arm64 works for me but I would like to support 32 bit until Google pulls the plug on 32 bit

@OnlyMyRailgun

This comment was marked as off-topic.

Copy link

commented Oct 9, 2018

Flutter Team, please resolve this basic issue!

@lianjianjie

This comment has been minimized.

Copy link

commented Oct 10, 2018

lots of third SDK not working, i think it's urgent

@philipgiuliani

This comment has been minimized.

Copy link

commented Oct 12, 2018

I can reproduce this when adding Mapbox to the android application.

@John-jin

This comment has been minimized.

Copy link

commented Oct 31, 2018

I have the same problem too.I use baiduMap in my Project,bebug model is ok,release crash.
user flutter build apk --release --target-platform=android-arm64 in my phone is ok,but 32 bit phone will crash.Flutter Team,please resolve this issue as soon as possible.

@JackJonson

This comment has been minimized.

Copy link

commented Nov 1, 2018

Similar to https://github.com/azihsoyn/flutter_mlkit/issues/36 , it works for me , the apk can run in both 32bit and 64bit phone. @peace2knowledge

@krmao

This comment has been minimized.

Copy link

commented Nov 2, 2018

this should be very important problem for release apk

@jeffreyyoung

This comment has been minimized.

Copy link

commented Nov 2, 2018

is there a work around for this issue?

@zephyrluo

This comment has been minimized.

Copy link

commented Nov 5, 2018

  1. extract lib/armeabi-v7a/libflutter.so from $<FLUTTER>/bin/cache/artifacts/engine/android-arm-release/flutter.jar
  2. copy file armeabi-v7a/libflutter.so into $<project>/android/jniLibs/armeabi-v7a/
  3. modify $<project>/android/app/build.gradle as below:
android {
...
    buildTypes {
        release {
            // TODO: Add your own signing config for the release build.
            // Signing with the debug keys for now, so `flutter run --release` works.
            signingConfig signingConfigs.debug
            ndk {
                abiFilters "arm"
            }
        }
        debug {
            ndk {
                abiFilters "arm"
            }
        }
}
    }

@zoechi zoechi added this to the Goals milestone Nov 5, 2018

alexli1984 pushed a commit to alexli1984/flutter_playground that referenced this issue Nov 6, 2018

@INRIX-joel-winarske

This comment has been minimized.

Copy link

commented Nov 28, 2018

For NDK, the 64-bit toolchain requires minSdkVersion >= 21.

This unblocked me (with proper minSdkVersion set):

minSdkVersion=16

flutter build apk --release --target-platform=android-arm
flutter run --release --target-platform=android-arm

minSdkVersion=21

flutter build apk --release --target-platform=android-arm64
flutter run --release --target-platform=android-arm64
@RockCoder7

This comment has been minimized.

Copy link

commented Nov 28, 2018

Delete all abiFilters, it works for me.

@MoacirSchmidt

This comment has been minimized.

Copy link

commented May 22, 2019

@blasten

I switched to the master channel, upgraded and build the appbundle. Unfortunately app chashes after downloaded from google play store with following logcat

2019-05-22 09:42:14.824 6995-6995/? E/flutter: [ERROR:flutter/runtime/dart_vm_data.cc(19)] VM snapshot invalid and could not be inferred from settings.
2019-05-22 09:42:14.824 6995-6995/? E/flutter: [ERROR:flutter/runtime/dart_vm.cc(241)] Could not setup VM data to bootstrap the VM from.
2019-05-22 09:42:14.824 6995-6995/? E/flutter: [ERROR:flutter/runtime/dart_vm_lifecycle.cc(89)] Could not create Dart VM instance.
2019-05-22 09:42:14.824 6995-6995/? A/flutter: [FATAL:flutter/shell/common/shell.cc(218)] Check failed: vm. Must be able to initialize the VM.

flutter build appbundle is now in master, does any voluntary person want to give it try?

We had some discussion to support a list of platforms in build apk, so you could do something like this: flutter build apk --target-platform android-arm,android-arm64

@CaramelDunes

This comment has been minimized.

Copy link

commented May 22, 2019

@blasten

I switched to the master channel, upgraded and build the appbundle. Unfortunately app chashes after downloaded from google play store with following logcat

2019-05-22 09:42:14.824 6995-6995/? E/flutter: [ERROR:flutter/runtime/dart_vm_data.cc(19)] VM snapshot invalid and could not be inferred from settings.
2019-05-22 09:42:14.824 6995-6995/? E/flutter: [ERROR:flutter/runtime/dart_vm.cc(241)] Could not setup VM data to bootstrap the VM from.
2019-05-22 09:42:14.824 6995-6995/? E/flutter: [ERROR:flutter/runtime/dart_vm_lifecycle.cc(89)] Could not create Dart VM instance.
2019-05-22 09:42:14.824 6995-6995/? A/flutter: [FATAL:flutter/shell/common/shell.cc(218)] Check failed: vm. Must be able to initialize the VM.

flutter build appbundle is now in master, does any voluntary person want to give it try?
We had some discussion to support a list of platforms in build apk, so you could do something like this: flutter build apk --target-platform android-arm,android-arm64

Have the same problem, although I do not have any logs yet.

@blasten

This comment has been minimized.

Copy link
Contributor

commented May 22, 2019

@skybur the issue you were having might be related to #33119. If that is case, this patch should fix it.

@jereksel

This comment has been minimized.

Copy link

commented May 22, 2019

@ndusart
Yeah, you're right. I've checked bundletool source code and assets split is only by language indeed:
https://github.com/google/bundletool/blob/master/src/main/java/com/android/tools/build/bundletool/splitters/ModuleSplitter.java#L286

@Tokenyet

This comment has been minimized.

Copy link

commented May 22, 2019

This was my solution:

  1. in app gradle
splits {
        // Configures multiple APKs based on ABI.
        abi {
            // Enables building multiple APKs per ABI.
            enable true
            // By default all ABIs are included, so use reset() and include to specify that we only
            // want APKs for armeabi-v7a and arm64-v8a.

            // Resets the list of ABIs that Gradle should create APKs for to none.
            reset()

            // Specifies a list of ABIs that Gradle should create APKs for.
            include "armeabi-v7a", "arm64-v8a"

            // Specifies that we do not want to also generate a universal APK that includes all ABIs.
            universalApk false
        }
    }
  1. run flutter build apk --release --target-platform=android-arm
  2. upload app-armeabi-v7a-release.apk to the play store
  3. increment versionCode
  4. run flutter build apk --release --target-platform=android-arm64
  5. upload app-arm64-v8a-release.apk to the play store

Google play store will serve App according to device architecture. 32bit devices are happy, 64bit devices are happy and I'm happy knowing that my APK size remains relatively small while still serving both architectures.

If we include support for both architectures in the same APK, expect the size of your app to be 10MB+

There is an important thing to tell you guys. If you use the method I quote. You might need to comment out the setting, when you want to keep debugging your App. I face the error Gradle build failed to produce an Android package, and stuck for few hours, making some gradlew clean...etc, and finally found out this should be commented out!

Hope this helped someone to jump out.

@Tokenyet

This comment has been minimized.

Copy link

commented May 22, 2019

flutter build appbundle is now in master, does any voluntary person want to give it try?

We had some discussion to support a list of platforms in build apk, so you could do something like this: flutter build apk --target-platform android-arm,android-arm64

flutter build appbundle is working! I don't need to add that setting, and just do the code. However, It takes a bit much time to compile, but It's the only way to pass Google Play now.

@blasten

This comment has been minimized.

Copy link
Contributor

commented May 22, 2019

@Tokenyet were you able to download the app from the Play Store and run it after uploading the .aab? If this is the case, would you mind pasting the output of flutter doctor?

@blasten blasten modified the milestones: Near-term Goals, May 2019 May 22, 2019

@robinbonnes

This comment has been minimized.

Copy link

commented May 22, 2019

@blasten

I switched to the master channel, upgraded and build the appbundle. Unfortunately app chashes after downloaded from google play store with following logcat

2019-05-22 09:42:14.824 6995-6995/? E/flutter: [ERROR:flutter/runtime/dart_vm_data.cc(19)] VM snapshot invalid and could not be inferred from settings.
2019-05-22 09:42:14.824 6995-6995/? E/flutter: [ERROR:flutter/runtime/dart_vm.cc(241)] Could not setup VM data to bootstrap the VM from.
2019-05-22 09:42:14.824 6995-6995/? E/flutter: [ERROR:flutter/runtime/dart_vm_lifecycle.cc(89)] Could not create Dart VM instance.
2019-05-22 09:42:14.824 6995-6995/? A/flutter: [FATAL:flutter/shell/common/shell.cc(218)] Check failed: vm. Must be able to initialize the VM.

flutter build appbundle is now in master, does any voluntary person want to give it try?
We had some discussion to support a list of platforms in build apk, so you could do something like this: flutter build apk --target-platform android-arm,android-arm64

Exactly the same thing here, when trying to run my app from the Play Store (created as appbundle). What logs do you guys need to resolve this?

@blasten

This comment has been minimized.

Copy link
Contributor

commented May 23, 2019

This will be helpful:

  1. Download bundletool from https://developer.android.com/studio/command-line/bundletool
  2. Run flutter build appbundle (Please indicate if you pass any flag or if you made custom changes to any Gradle script)
  3. Run bundletool build-apks --bundle=build/app/outputs/bundle/release/app.aab --output=out.apks to extract the APK set.
  4. Run unzip -l out.apks and lastly flutter doctor and paste the output from both commands in your comment.

If possible:

Test locally on the device using the bundletool and the APK set. These are the steps, paste the logcat in your comment.

I'm unable to reproduce the issue although I only tested locally using bundletool.

@skybur

This comment has been minimized.

Copy link

commented May 23, 2019

@blasten So the previous error is fixed but I ran into another error. I assume this is caused by something in my project. Is there any way I could debug this?

[+6084 ms] Failed to execute aapt
[  +17 ms] com.android.ide.common.process.ProcessException: Failed to execute aapt
[   +1 ms]      at com.android.builder.core.AndroidBuilder.processResources(AndroidBuilder.java:809)
[   +1 ms]      at com.android.build.gradle.internal.res.LinkAndroidResForBundleTask.taskAction(LinkAndroidResForBundleTask.kt:128)
[   +1 ms]      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[   +1 ms]      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[   +1 ms]      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[        ]      at java.lang.reflect.Method.invoke(Method.java:498)
[        ]      at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
[   +4 ms]      at org.gradle.api.internal.project.taskfactory.StandardTaskAction.doExecute(StandardTaskAction.java:46)
[   +1 ms]      at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:39)
[        ]      at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:26)
[   +3 ms]      at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:788)
[  +29 ms]      at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:755)
[   +1 ms]      at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:124)
[   +1 ms]      at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
[   +2 ms]      at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
[   +1 ms]      at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
[   +9 ms]      at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
[        ]      at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:113)
[        ]      at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:95)
[   +1 ms]      at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:73)
[        ]      at org.gradle.api.internal.tasks.execution.OutputDirectoryCreatingTaskExecuter.execute(OutputDirectoryCreatingTaskExecuter.java:51)
[   +1 ms]      at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:59)
[        ]      at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
[        ]      at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:59)
[   +5 ms]      at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:101)
[        ]      at org.gradle.api.internal.tasks.execution.FinalizeInputFilePropertiesTaskExecuter.execute(FinalizeInputFilePropertiesTaskExecuter.java:44)
[   +1 ms]      at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:91)
[   +1 ms]      at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:62)
[  +12 ms]      at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:59)
[   +4 ms]      at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
[        ]      at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
[        ]      at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
[        ]      at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.run(DefaultTaskGraphExecuter.java:256)
[        ]      at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
[        ]      at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
[        ]      at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
[        ]      at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
[   +1 ms]      at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:249)
[   +6 ms]      at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:238)
[        ]      at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.processTask(DefaultTaskPlanExecutor.java:123)
[        ]      at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.access$200(DefaultTaskPlanExecutor.java:79)
[        ]      at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:104)
[   +1 ms]      at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:98)
[   +1 ms]      at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.java:663)
[   +1 ms]      at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:597)
[        ]      at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.java:98)
[  +14 ms]      at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
[   +1 ms]      at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
[   +4 ms]      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
[   +1 ms]      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
[   +2 ms]      at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
[   +1 ms]      at java.lang.Thread.run(Thread.java:745)
[  +26 ms] Caused by: java.util.concurrent.ExecutionException: java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: AAPT2 error: check logs for details
[   +4 ms]      at com.google.common.util.concurrent.AbstractFuture.getDoneValue(AbstractFuture.java:503)
[   +1 ms]      at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:482)
[        ]      at com.google.common.util.concurrent.AbstractFuture$TrustedFuture.get(AbstractFuture.java:79)
[        ]      at com.android.builder.internal.aapt.AbstractAapt.link(AbstractAapt.java:34)
[        ]      at com.android.builder.core.AndroidBuilder.processResources(AndroidBuilder.java:807)
[        ]      ... 51 more
[        ] Caused by: java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: AAPT2 error: check logs for details
[   +1 ms]      at com.google.common.util.concurrent.AbstractFuture.getDoneValue(AbstractFuture.java:503)
[        ]      at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:462)
[        ]      at com.google.common.util.concurrent.AbstractFuture$TrustedFuture.get(AbstractFuture.java:79)
[        ]      at com.android.builder.internal.aapt.v2.QueueableAapt2.lambda$makeValidatedPackage$1(QueueableAapt2.java:166)
[   +4 ms]      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
[   +1 ms]      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
[   +1 ms]      ... 1 more
[   +1 ms] Caused by: com.android.builder.internal.aapt.v2.Aapt2Exception: AAPT2 error: check logs for details
[   +1 ms]      at com.android.builder.png.AaptProcess$NotifierProcessOutput.handleOutput(AaptProcess.java:443)
[   +1 ms]      at com.android.builder.png.AaptProcess$NotifierProcessOutput.err(AaptProcess.java:395)
[        ]      at com.android.builder.png.AaptProcess$ProcessOutputFacade.err(AaptProcess.java:312)
[        ]      at com.android.utils.GrabProcessOutput$1.run(GrabProcessOutput.java:104)
[        ] FAILURE: Build failed with an exception.
[        ] * What went wrong:
[        ] Execution failed for task ':app:bundleProdReleaseResources'.
[        ] > Failed to execute aapt
[        ] * 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.
[   +5 ms] * Get more help at https://help.gradle.org
[        ] BUILD FAILED in 30s
[ +324 ms] Running Gradle task 'bundleProdRelease'... (completed in 31.5s)
@Kiruel

This comment has been minimized.

Copy link

commented May 23, 2019

@blasten I follow all your steps my logs:

➜  PROJECT_NAME git:(master) ✗ unzip -l out.apks
Archive:  out.apks
  Length      Date    Time    Name
---------  ---------- -----   ----
 43369811  01-01-1970 01:00   standalones/standalone-armeabi_tvdpi.apk
 43327197  01-01-1970 01:00   standalones/standalone-armeabi_hdpi.apk
 43319503  01-01-1970 01:00   standalones/standalone-armeabi_mdpi.apk
 43320027  01-01-1970 01:00   standalones/standalone-armeabi_ldpi.apk
 43346424  01-01-1970 01:00   standalones/standalone-armeabi_xxhdpi.apk
 43350403  01-01-1970 01:00   standalones/standalone-armeabi_xxxhdpi.apk
 43332970  01-01-1970 01:00   standalones/standalone-armeabi_xhdpi.apk
 50349155  01-01-1970 01:00   standalones/standalone-armeabi_v7a_ldpi.apk
 50348629  01-01-1970 01:00   standalones/standalone-armeabi_v7a_mdpi.apk
 50398968  01-01-1970 01:00   standalones/standalone-armeabi_v7a_tvdpi.apk
 50356358  01-01-1970 01:00   standalones/standalone-armeabi_v7a_hdpi.apk
 50362126  01-01-1970 01:00   standalones/standalone-armeabi_v7a_xhdpi.apk
 50375565  01-01-1970 01:00   standalones/standalone-armeabi_v7a_xxhdpi.apk
 50379553  01-01-1970 01:00   standalones/standalone-armeabi_v7a_xxxhdpi.apk
 50660246  01-01-1970 01:00   standalones/standalone-arm64_v8a_ldpi.apk
 50659718  01-01-1970 01:00   standalones/standalone-arm64_v8a_mdpi.apk
 50710027  01-01-1970 01:00   standalones/standalone-arm64_v8a_tvdpi.apk
 50667415  01-01-1970 01:00   standalones/standalone-arm64_v8a_hdpi.apk
 50673185  01-01-1970 01:00   standalones/standalone-arm64_v8a_xhdpi.apk
 50686641  01-01-1970 01:00   standalones/standalone-arm64_v8a_xxhdpi.apk
 43345757  01-01-1970 01:00   standalones/standalone-x86_mdpi.apk
 43346287  01-01-1970 01:00   standalones/standalone-x86_ldpi.apk
 43396086  01-01-1970 01:00   standalones/standalone-x86_tvdpi.apk
 50690619  01-01-1970 01:00   standalones/standalone-arm64_v8a_xxxhdpi.apk
 43359247  01-01-1970 01:00   standalones/standalone-x86_xhdpi.apk
 43353470  01-01-1970 01:00   standalones/standalone-x86_hdpi.apk
 43372688  01-01-1970 01:00   standalones/standalone-x86_xxhdpi.apk
 43376653  01-01-1970 01:00   standalones/standalone-x86_xxxhdpi.apk
 43340224  01-01-1970 01:00   standalones/standalone-x86_64_ldpi.apk
 43339701  01-01-1970 01:00   standalones/standalone-x86_64_mdpi.apk
 43390033  01-01-1970 01:00   standalones/standalone-x86_64_tvdpi.apk
 43347418  01-01-1970 01:00   standalones/standalone-x86_64_hdpi.apk
    57027  01-01-1970 01:00   splits/base-ldpi.apk
    56501  01-01-1970 01:00   splits/base-mdpi.apk
    61951  01-01-1970 01:00   splits/base-hdpi.apk
    67741  01-01-1970 01:00   splits/base-xhdpi.apk
    81187  01-01-1970 01:00   splits/base-xxhdpi.apk
    85188  01-01-1970 01:00   splits/base-xxxhdpi.apk
   105385  01-01-1970 01:00   splits/base-tvdpi.apk
 43353194  01-01-1970 01:00   standalones/standalone-x86_64_xhdpi.apk
    11313  01-01-1970 01:00   splits/base-ca.apk
    11211  01-01-1970 01:00   splits/base-da.apk
    12040  01-01-1970 01:00   splits/base-fa.apk
    11659  01-01-1970 01:00   splits/base-ja.apk
    12486  01-01-1970 01:00   splits/base-ka.apk
    12511  01-01-1970 01:00   splits/base-pa.apk
    12856  01-01-1970 01:00   splits/base-ta.apk
    11195  01-01-1970 01:00   splits/base-nb.apk
    12001  01-01-1970 01:00   splits/base-be.apk
    11420  01-01-1970 01:00   splits/base-de.apk
    13041  01-01-1970 01:00   splits/base-ne.apk
    12674  01-01-1970 01:00   splits/base-te.apk
 43366615  01-01-1970 01:00   standalones/standalone-x86_64_xxhdpi.apk
    11179  01-01-1970 01:00   splits/base-af.apk
    12151  01-01-1970 01:00   splits/base-bg.apk
    12353  01-01-1970 01:00   splits/base-th.apk
    11228  01-01-1970 01:00   splits/base-fi.apk
    12537  01-01-1970 01:00   splits/base-si.apk
    12551  01-01-1970 01:00   splits/base-hi.apk
    11939  01-01-1970 01:00   splits/base-kk.apk
    11615  01-01-1970 01:00   splits/base-vi.apk
    12059  01-01-1970 01:00   splits/base-mk.apk
    11440  01-01-1970 01:00   splits/base-sk.apk
    11961  01-01-1970 01:00   splits/base-uk.apk
    12344  01-01-1970 01:00   splits/base-el.apk
    11342  01-01-1970 01:00   splits/base-gl.apk
    13334  01-01-1970 01:00   splits/base-ml.apk
    11350  01-01-1970 01:00   splits/base-nl.apk
    11371  01-01-1970 01:00   splits/base-pl.apk
    11311  01-01-1970 01:00   splits/base-sl.apk
    11428  01-01-1970 01:00   splits/base-tl.apk
    11825  01-01-1970 01:00   splits/base-am.apk
    12685  01-01-1970 01:00   splits/base-km.apk
    12615  01-01-1970 01:00   splits/base-bn.apk
    11223  01-01-1970 01:00   splits/base-in.apk
    12832  01-01-1970 01:00   splits/base-kn.apk
    11958  01-01-1970 01:00   splits/base-mn.apk
    12621  01-01-1970 01:00   splits/base-lo.apk
    11425  01-01-1970 01:00   splits/base-ko.apk
    11395  01-01-1970 01:00   splits/base-ro.apk
    11438  01-01-1970 01:00   splits/base-sq.apk
    13612  01-01-1970 01:00   splits/base-fr.apk
    11647  01-01-1970 01:00   splits/base-ar.apk
    11278  01-01-1970 01:00   splits/base-hr.apk
    12447  01-01-1970 01:00   splits/base-mr.apk
    12943  01-01-1970 01:00   splits/base-or.apk
    14244  01-01-1970 01:00   splits/base-sr.apk
    11316  01-01-1970 01:00   splits/base-tr.apk
    11973  01-01-1970 01:00   splits/base-ur.apk
    11308  01-01-1970 01:00   splits/base-bs.apk
    12525  01-01-1970 01:00   splits/base-as.apk
    13704  01-01-1970 01:00   splits/base-es.apk
    11367  01-01-1970 01:00   splits/base-cs.apk
    11222  01-01-1970 01:00   splits/base-is.apk
    11360  01-01-1970 01:00   splits/base-ms.apk
    11323  01-01-1970 01:00   splits/base-et.apk
    11283  01-01-1970 01:00   splits/base-it.apk
    11550  01-01-1970 01:00   splits/base-lt.apk
    14605  01-01-1970 01:00   splits/base-pt.apk
    11377  01-01-1970 01:00   splits/base-eu.apk
    12409  01-01-1970 01:00   splits/base-gu.apk
    11651  01-01-1970 01:00   splits/base-hu.apk
    12048  01-01-1970 01:00   splits/base-ru.apk
    11616  01-01-1970 01:00   splits/base-lv.apk
    11314  01-01-1970 01:00   splits/base-zu.apk
    11260  01-01-1970 01:00   splits/base-sv.apk
    11539  01-01-1970 01:00   splits/base-iw.apk
    11283  01-01-1970 01:00   splits/base-sw.apk
    12110  01-01-1970 01:00   splits/base-hy.apk
 43370609  01-01-1970 01:00   standalones/standalone-x86_64_xxxhdpi.apk
    11904  01-01-1970 01:00   splits/base-ky.apk
    11430  01-01-1970 01:00   splits/base-az.apk
    13395  01-01-1970 01:00   splits/base-my.apk
    11296  01-01-1970 01:00   splits/base-uz.apk
    15398  01-01-1970 01:00   splits/base-zh.apk
    23877  01-01-1970 01:00   splits/base-en.apk
   107757  01-01-1970 01:00   splits/base-armeabi.apk
   134023  01-01-1970 01:00   splits/base-x86.apk
   127969  01-01-1970 01:00   splits/base-x86_64.apk
 42926206  01-01-1970 01:00   splits/base-master.apk
 21480838  01-01-1970 01:00   splits/base-arm64_v8a_2.apk
 17508309  01-01-1970 01:00   splits/base-armeabi_v7a_2.apk
   217751  01-01-1970 01:00   splits/base-armeabi_2.apk
   311771  01-01-1970 01:00   splits/base-x86_2.apk
   308537  01-01-1970 01:00   splits/base-x86_64_2.apk
  7136923  01-01-1970 01:00   splits/base-armeabi_v7a.apk
  7447993  01-01-1970 01:00   splits/base-arm64_v8a.apk
 42926200  01-01-1970 01:00   splits/base-master_2.apk
    16537  01-01-1970 01:00   toc.pb
---------                     -------
1759809847                     129 files
➜  PROJECT_NAME git:(master) ✗ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel master, v1.6.1-pre.68, on Mac OS X 10.14.5 18F132, locale en-GB)

[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[✓] iOS toolchain - develop for iOS devices (Xcode 10.2.1)
[!] Android Studio (version 3.3)
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
[✓] VS Code (version 1.34.0)
[✓] Connected device (1 available)

! Doctor found issues in 1 category.
@SPodjasek

This comment has been minimized.

Copy link
Contributor

commented May 23, 2019

@jereksel @ndusart
Actually this is called Assets Targeting and it allows you to target/split directories in assets based on Graphics API, Language & Texture Compression.
As seen here: .../bundletool/model/targeting/TargetedDirectorySegment.java

@SPodjasek

This comment has been minimized.

Copy link
Contributor

commented May 23, 2019

Regarding AAB's current flutter@master works for me locally - using bundletool to test and install on real device. I've disabled splitting on density & language in my build.gradle so build-apks gives me this:

  Length      Date    Time    Name
---------  ---------- -----   ----
  6872466  1970-01-01 01:00   splits/base-arm64_v8a.apk
  6726824  1970-01-01 01:00   splits/base-master.apk
 13289718  1970-01-01 01:00   standalones/standalone-armeabi_v7a.apk
 13594392  1970-01-01 01:00   standalones/standalone-arm64_v8a.apk
  6567785  1970-01-01 01:00   splits/base-armeabi_v7a.apk
      429  1970-01-01 01:00   toc.pb
---------                     -------
 47051614                     6 files

Testing it on Test Lab I also have all green.
Still waiting for Play Store to process this version to test this channel.

@Tokenyet

This comment has been minimized.

Copy link

commented May 23, 2019

@Tokenyet were you able to download the app from the Play Store and run it after uploading the .aab? If this is the case, would you mind pasting the output of flutter doctor?

I can download the app from the Play Store, and run It. You could [give It a try] (https://play.google.com/store/apps/details?id=com.bumbystudio.starry_clock). (Edit: Oops, It's not wokring...from PlayStore)

Below is my flutter doctor as you need. Hope It helped.

[√] Flutter (Channel master, v1.6.1-pre.88, on Microsoft Windows [Version 10.0.17134.765], locale zh-TW)

[√] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[√] Android Studio (version 3.3)
[√] VS Code, 64-bit edition (version 1.30.2)
[!] Connected device
! No devices available

@kishan2612

This comment has been minimized.

Copy link

commented May 23, 2019

This works fine for me !

buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so flutter run --release works.
signingConfig signingConfigs.debug
}
debug {
ndk {
abiFilters 'armeabi-v7a'
}
}
}

@ndusart

This comment has been minimized.

Copy link

commented May 23, 2019

@SPodjasek still, we need to split assets/ based on ABI. How can this be done currently ?

@Purus

This comment has been minimized.

Copy link

commented May 23, 2019

@SPodjasek

This comment has been minimized.

Copy link
Contributor

commented May 23, 2019

@ndusart At this point it's impossible - maybe file a feature request on bundletool and Google will consider implementing it.

@ened ened referenced this issue May 23, 2019

Closed

Replace platform-name dashes in gradle task name #33256

8 of 9 tasks complete
@ndusart

This comment has been minimized.

Copy link

commented May 23, 2019

@SPodjasek so that's what I'm saying, all this issue is going the wrong way.

All the discussions seems to end to "ho don't worry, when we could build app bundles, all would be fine" but it is totally not the case right now and in a close future.
It's a bit disappointing to see flutter team let people think it is possible this way.

flutter should be able to provide a way to easily build split APK either by doing the split itself or manage to move the VM snapshots to the lib/ folder and let the split just work (we could then use app bundles as well)

@blasten

This comment has been minimized.

Copy link
Contributor

commented May 23, 2019

Let’s recap:

  1. Flutter will support fat APKs via flutter build apk ....
  2. If you want to try this feature right now try flutter build appbundle in the master branch. If app bundles don’t work for your use case, then (1) should cover the remaining cases.
@ndusart

This comment has been minimized.

Copy link

commented May 23, 2019

Okay @blasten I did look in the master code and the snapshots are moved to the lib folder:

// Add the snapshots and rename them as `lib/{abi}/*.so`.
flutterTasks.each { flutterTask ->
from(flutterTask.intermediateDir) {
include 'vm_snapshot_data'
include 'vm_snapshot_instr'
include 'isolate_snapshot_data'
include 'isolate_snapshot_instr'
rename { String filename ->
return "lib/${flutterTask.abi}/lib_${filename}.so"
}
}
}

So it is not just adding app bundle support. It is more clear now.
A bit of explanation would have been appreciated though as it was stated that the problem was the assets folder and no information was given work was done in this direction since this problem and app bundle support are pretty independant.

Thanks for your work.

@dnfield

This comment has been minimized.

Copy link
Member

commented May 23, 2019

@ndusart - @blasten has made changes to the Android embedding so that it will look for the binary blobs in the lib folder now, so that you can bundle in both types if I'm not mistaken...

@jereksel

This comment has been minimized.

Copy link

commented May 23, 2019

If snapshotes are moved into lib, then maybe #30846 will be also fixed?

@devhulk

This comment has been minimized.

Copy link

commented May 24, 2019

@blasten
I switched to the master channel, upgraded and build the appbundle. Unfortunately app chashes after downloaded from google play store with following logcat

2019-05-22 09:42:14.824 6995-6995/? E/flutter: [ERROR:flutter/runtime/dart_vm_data.cc(19)] VM snapshot invalid and could not be inferred from settings.
2019-05-22 09:42:14.824 6995-6995/? E/flutter: [ERROR:flutter/runtime/dart_vm.cc(241)] Could not setup VM data to bootstrap the VM from.
2019-05-22 09:42:14.824 6995-6995/? E/flutter: [ERROR:flutter/runtime/dart_vm_lifecycle.cc(89)] Could not create Dart VM instance.
2019-05-22 09:42:14.824 6995-6995/? A/flutter: [FATAL:flutter/shell/common/shell.cc(218)] Check failed: vm. Must be able to initialize the VM.

flutter build appbundle is now in master, does any voluntary person want to give it try?
We had some discussion to support a list of platforms in build apk, so you could do something like this: flutter build apk --target-platform android-arm,android-arm64

Have the same problem, although I do not have any logs yet.

Same here. Was having error. Upgraded master and ran flutter build appbundle . Got rid of the error but app crashes when opened.

@CaramelDunes

This comment has been minimized.

Copy link

commented May 25, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.