Skip to content

Snappy1

  • Home
  • Android
  • What
  • How
  • Is
  • Can
  • Does
  • Do
  • Why
  • Are
  • Who
  • Toggle search form

[FIXED] android – Using flutter module in kotlin multiplatform app

Posted on November 11, 2022 By

Solution 1 :

Try to add flutter.hostAppProjectName=MusicTraining into gradle.properties file with both Flutter module and you root project.

Notice: run you native application, If you run main.dart, you still get this error

I face the same problem, this works for me.

Solution 2 :

If you already have a Kotlin multiplatform project, I’d use Jetbrains Compose multiplatform instead of Flutter. Compose is very similar to Flutter and you would avoid the technology split.

https://www.jetbrains.com/de-de/lp/compose-mpp/

Problem :

I created an application with kotlin multiplatform and I want now to use flutter to develop the UI once. I followed the tutorial to integrate flutter in an already existing Android app and I choose option B to compile everything in one step.

The first trouble is including the Flutter module as a subproject in the host app: in the kotlin multiplatform project, I have to rename the settings.gradle.kts to settings.gradle. Then I have another error I can’t get rid of: Caused by: java.lang.AssertionError: Project :app doesn't exist. To custom the host app project name, set 'org.gradle.project.flutter.hostAppProjectName=<project-name>' in gradle.properties.. Expression: (appProject != null). Values: appProject = null

I understand what the error means: with kotlin multiplatform, the project is not called app but the name of the app, in my case MusicTraining. So as mentioned in the kotlin documentation:

Tip: By default, the host app provides the: app Gradle project. To change the name of this project, set flutter.hostAppProjectName in the Flutter module’s gradle.properties file. Finally, include this project in the host app’s settings.gradle file mentioned below.

So, in the flutter module’s gradle.properties file I tried to add the lines:

  • flutter.hostAppProjectName="MusicTraining"
  • flutter.hostAppProjectName=":MusicTraining"

I still have the same error.

READ  [FIXED] Create directory on Android R
Powered by Inline Related Posts

I tried with vscode to change all instances of :app to :MusicTraining but nothing works. I still have the same error.

As the error mention, I tried to add the line

  • org.gradle.project.flutter.hostAppProjectName="MusicTraining"
  • org.gradle.project.flutter.hostAppProjectName=":MusicTraining"

in the flutter module’s gradle.properties file, but still the same error.

How can I integrate a flutter module in a kotlin multiplatform app?

Comments

Comment posted by aSemy

Have you tried

Comment posted by Adrien

works perfectly for me too, thanks

Comment posted by Adrien

I’ll take a look at that, does compose run natively on ios and android?

Comment posted by mipa

On Android yes, on iOS the comparable variant is still experimental. It also runs on desktop (JVM) and native on macOS, Linux and Windows and it also runs in the Web.

Android Tags:android, flutter, gradle, gradle-kotlin-dsl, kotlin-multiplatform

Post navigation

Previous Post: [FIXED] android – How to detect when third party app’s dialog box appears in React native?
Next Post: [FIXED] android – Get the list of user SIM cards and select it – flutter

Related Posts

[FIXED] c# – ViewModel not updating form (Xamarin.Forms) Android
[FIXED] java – Is it possible to create a method using these interfaces as parameters? Android
[FIXED] android – How to add third party SDK properly to Cordova plugin? Android
[FIXED] android – Equal height and width of RecyclerView items Android
[FIXED] android – YoutubePlayer – onError method is not getting called Android
[FIXED] android – is there any way to push the following file in adb using python scripting? Android

Archives

  • March 2023
  • February 2023
  • January 2023
  • December 2022
  • November 2022
  • October 2022
  • September 2022

Categories

  • ¿Cómo
  • ¿Cuál
  • ¿Cuándo
  • ¿Cuántas
  • ¿Cuánto
  • ¿Qué
  • Android
  • Are
  • At
  • C'est
  • Can
  • Comment
  • Did
  • Do
  • Does
  • Est-ce
  • Est-il
  • For
  • Has
  • Hat
  • How
  • In
  • Is
  • Ist
  • Kann
  • Où
  • Pourquoi
  • Quand
  • Quel
  • Quelle
  • Quelles
  • Quels
  • Qui
  • Should
  • Sind
  • Sollte
  • Uncategorized
  • Wann
  • Warum
  • Was
  • Welche
  • Welchen
  • Welcher
  • Welches
  • Were
  • What
  • What's
  • When
  • Where
  • Which
  • Who
  • Who's
  • Why
  • Wie
  • Will
  • Wird
  • Wo
  • Woher
  • you can create a selvedge edge: You can make the edges of garter stitch more smooth by slipping the first stitch of every row.2022-02-04
  • you really only need to know two patterns: garter stitch

Recent Posts

  • What are the main features of Islamic education?
  • Is the Jeep 4xe worth it?
  • How does the ringer work on cast iron?
  • What is the biggest size interior door?
  • Is blue raspberry an original Jolly Rancher flavor?

Recent Comments

No comments to show.

Copyright © 2023 Snappy1.

Powered by PressBook Grid Dark theme