2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Flutterサンプルを動かすのにFailed to execute aaptが出た

Last updated at Posted at 2019-09-27

はじめに

ここ↓を参考に、いくつかサンプルを動かそうと思って
https://qiita.com/ikemura23/items/255a6980c57afd0f3856

ここ↓のjsonexampleを試してみようと思い、クローン
https://github.com/flutter/samples/blob/master/INDEX.md

そしてrun

/Users/user/.gradle/caches/transforms-1/files-1.1/support-compat-28.0.0.aar/80283d6ca3ee3c256d26009235bbdbbe/res/values/values.xml:133:5-70: AAPT: error: resource android:attr/fontVariationSettings not found.

/Users/user/.gradle/caches/transforms-1/files-1.1/support-compat-28.0.0.aar/80283d6ca3ee3c256d26009235bbdbbe/res/values/values.xml:133:5-70: AAPT: error: resource android:attr/ttcIndex not found.

/Users/user/Downloads/samples-master/jsonexample/build/app/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml:84: error: resource android:attr/fontVariationSettings not found.
/Users/user/Downloads/samples-master/jsonexample/build/app/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml:84: error: resource android:attr/ttcIndex not found.
error: failed linking references.

Failed to execute aapt
com.android.ide.common.process.ProcessException: Failed to execute aapt
	at com.android.builder.core.AndroidBuilder.processResources(AndroidBuilder.java:796)
	at com.android.build.gradle.tasks.ProcessAndroidResources.invokeAaptForSplit(ProcessAndroidResources.java:551)
	at com.android.build.gradle.tasks.ProcessAndroidResources.doFullTaskAction(ProcessAndroidResources.java:285)
	at com.android.build.gradle.internal.tasks.IncrementalTask.taskAction(IncrementalTask.java:109)
	at sun.reflect.GeneratedMethodAccessor655.invoke(Unknown Source)
	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)
	at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$IncrementalTaskAction.doExecute(DefaultTaskClassInfoStore.java:173)
	at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.java:134)
	at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.java:121)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:122)
	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:197)
	at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:107)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:111)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:92)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:70)
	at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:63)
	at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
	at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
	at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:88)
	at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:52)
	at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
	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:248)
	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:197)
	at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:107)
・
・
・

あああああああああああサンプルはそのまま動くようにしとけやあああああああ

環境

Android Studio3.5
Flutter 1.10.6 (dev channel)
Dart 2.6.0

試行錯誤

ここ↓とか参考に色々試してみるも、うまくいかない。
https://github.com/flutter/flutter/issues/27106

android/build.gradle
-subprojects {
-    project.evaluationDependsOn(':app')
-}

変わらず

gradle.properties
+android.useAndroidX=true
+android.enableJetifier=true

変わらず

詰む。

おや?

channelが・・・devになっている。

(base) MacBook-Pro:jsonexample user$ flutter channel
Flutter channels:
  beta
* dev
  master
  stable

sbableに変えて

(base) MacBook-Pro:jsonexample user$ flutter channel stable
Switching to flutter channel 'stable'...
git: From https://github.com/flutter/flutter
git:    104445722..b07056b10  master     -> origin/master
git: Switched to branch 'stable'
git: Your branch is up to date with 'origin/stable'.

upgradeする

(base) MacBook-Pro:jsonexample user$ flutter upgrade

そしてrun

Running "flutter pub get" in jsonexample... 

上がった!
スクリーンショット 2019-09-27 11.49.05.png

まとめ

サンプルに文句をいう前に環境を見直そう。(ATARIMAE)

2019/9/27現在のFlutterのstableは1.9です。
サンプルプロジェクトにも1.9対応済みが最新のコミットになってました。

Flutter単体ではdevでも大丈夫であっても、使ってるpluginとかの兼ね合いもあるので、
特にとりあえずサンプル動かす!という時はstable一択ですね。
もちろん開発としてがっつり使うときもそれはそれで当然stable一択なワケですが。

自分への戒めとしてここに記録しておきます。

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?