alan-ai / alan-sdk-flutter

Conversational AI SDK for Flutter to enable text and voice conversations with actions (iOS and Android)
https://alan.app
1.81k stars 39 forks source link

alan-sdk-flutter\examples\alan_simple_app>flutter run does not work. #17

Closed davehorner closed 1 year ago

davehorner commented 1 year ago

hello just trying to get the simple working.

I am stuck with: alan-sdk-flutter\examples\alan_simple_app>flutter run

Warning: Mapping new ns http://schemas.android.com/repository/android/common/02 to old ns http://schemas.android.com/repository/android/common/01
Warning: Mapping new ns http://schemas.android.com/repository/android/generic/02 to old ns http://schemas.android.com/repository/android/generic/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/02 to old ns http://schemas.android.com/sdk/android/repo/addon2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/03 to old ns http://schemas.android.com/sdk/android/repo/addon2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/02 to old ns http://schemas.android.com/sdk/android/repo/repository2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/03 to old ns http://schemas.android.com/sdk/android/repo/repository2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/03 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/02 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01
Warning: unexpected element (uri:"", local:"base-extension"). Expected elements are <{}codename>,<{}layoutlib>,<{}api-level>

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':package_info:compileDebugJavaWithJavac'.
> Failed to calculate the value of task ':package_info:compileDebugJavaWithJavac' property 'options.generatedSourceOutputDirectory'.
   > Querying the mapped value of map(java.io.File property(org.gradle.api.file.Directory, fixed(class org.gradle.api.internal.file.DefaultFilePropertyFactory$FixedDirectory, C:\working\flutter\alan-sdk-flutter\examples\alan_simple_app\build\package_info\generated\ap_generated_sources\debug\out)) org.gradle.api.internal.file.DefaultFilePropertyFactory$ToFileTransformer@703a40dc) before task ':package_info:compileDebugJavaWithJavac' has completed is not supported

* 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 13s
Running Gradle task 'assembleDebug'...                             14.7s
Exception: Gradle task assembleDebug failed with exit code 1

i had to update the sdk version, gradle, and the icons package. not sure what to do next to get the basics working again. I can create a PR if I can get it working. https://github.com/alan-ai/alan-sdk-flutter/compare/master...davehorner:alan-sdk-flutter:master

snyuryev commented 1 year ago

Hi @davehorner

What was original error which you had?

PS: You may use example app from here - https://pub.dev/packages/alan_voice/example

davehorner commented 1 year ago

You can see with a recent version of flutter that the build is not null safe and the cupertino icons have to be upgraded to support null safety.

On first run you get:

alan.2\examples\alan_simple_app>flutter run
Resolving dependencies...
The lower bound of "sdk: '>=2.1.0 <3.0.0'" must be 2.12.0'
or higher to enable null safety.

The current Dart SDK (3.0.5) only supports null safety.

For details, see https://dart.dev/null-safety

The same is true for the ShrineApp, that is also not working.

ShrineApp>flutter run
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Warning
──────────────────────────────────────────────────────────────────────────────
Your Flutter application is created using an older version of the Android
embedding. It is being deprecated in favor of Android embedding v2. To migrate
your project, follow the steps at:

https://github.com/flutter/flutter/wiki/Upgrading-pre-1.12-Android-projects

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
The detected reason was:

  c:\working\flutter\alan.2\examples\ShrineApp\android\app\src\main\AndroidManifest.xml uses `android:name="io.flutter.app.FlutterApplication"`
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Build failed due to use of deprecated Android v1 embedding.

The example you reference on the website; isn't that what I'm using? Are you suggesting I copy the code directly and create a new flutter app and go that route? I would have expected the example to be in the repo. I don't see alan_voice/example.

As mentioned before, you can get my fixes so far here: https://github.com/alan-ai/alan-sdk-flutter/compare/master...davehorner:alan-sdk-flutter:master

davehorner commented 1 year ago

I did a flutter create example and copied the pubspec and the main to the example folder. did a pub get

c:\working\flutter\alan-sdk-flutter\examples\alan_simple_app\example>flutter pub get
Resolving dependencies...
Found a legacy Pub cache at C:\Users\dhorner\AppData\Roaming\Pub\Cache. Pub is using C:\Users\dhorner\AppData\Local\Pub\Cache.

Consider deleting the legacy cache.

See https://dart.dev/resources/dart-3-migration#other-tools-changes for details.
+ alan_voice 3.12.0 (4.3.0 available)
  collection 1.17.1 (1.17.2 available)
  matcher 0.12.15 (0.12.16 available)
  material_color_utilities 0.2.0 (0.8.0 available)
+ package_info 2.0.2
  source_span 1.9.1 (1.10.0 available)
  stack_trace 1.11.0 (1.11.1 available)
  stream_channel 2.1.1 (2.1.2 available)
  test_api 0.5.1 (0.6.1 available)
These packages are no longer being depended on:
- flutter_lints 2.0.2
- lints 2.1.1
Changed 4 dependencies!

c:\working\flutter\alan-sdk-flutter\examples\alan_simple_app\example>flutter run
Launching lib\main.dart on moto g stylus 5G 2022 in debug mode...
Project dir is C:\working\flutter\alan-sdk-flutter\examples\alan_simple_app\example\android
Invalid depfile: C:\working\flutter\alan-sdk-flutter\examples\alan_simple_app\example\.dart_tool\flutter_build\3272f0fd74675b90bb56428aa5e5682e\kernel_snapshot.d
Invalid depfile: C:\working\flutter\alan-sdk-flutter\examples\alan_simple_app\example\.dart_tool\flutter_build\3272f0fd74675b90bb56428aa5e5682e\kernel_snapshot.d
lib/main.dart:30:19: Error: The parameter 'key' can't have a value of 'null' because of its type 'Key', but the implicit default value is 'null'.
 - 'Key' is from 'package:flutter/src/foundation/key.dart' ('/C:/tools/flutter/packages/flutter/lib/src/foundation/key.dart').
Try adding either an explicit non-'null' default value or the 'required' modifier.
  MyHomePage({Key key, this.title}) : super(key: key);
                  ^^^
lib/main.dart:30:29: Error: The parameter 'title' can't have a value of 'null' because of its type 'String', but the implicit default value is 'null'.
Try adding either an explicit non-'null' default value or the 'required' modifier.
  MyHomePage({Key key, this.title}) : super(key: key);
                            ^^^^^
Target kernel_snapshot failed: Exception

FAILURE: Build failed with an exception.

* Where:
Script 'C:\tools\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1201

* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'C:\tools\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

BUILD FAILED in 46s
Running Gradle task 'assembleDebug'...                             47.5s
Exception: Gradle task assembleDebug failed with exit code 1

null issues.

davehorner commented 1 year ago

I had success. If there is want I can try to create a PR.

snyuryev commented 1 year ago

Hi @davehorner I've updated simple example with new version of cupertino icons and AlanSDK packages. Should work with simple commands:

flutter pub get
flutter build ios
davehorner commented 1 year ago

I provided more changes than just the deps. flutter run still does not work given the latest code.

Warning: Mapping new ns http://schemas.android.com/repository/android/common/02 to old ns http://schemas.android.com/repository/android/common/01
Warning: Mapping new ns http://schemas.android.com/repository/android/generic/02 to old ns http://schemas.android.com/repository/android/generic/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/02 to old ns http://schemas.android.com/sdk/android/repo/addon2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/03 to old ns http://schemas.android.com/sdk/android/repo/addon2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/02 to old ns http://schemas.android.com/sdk/android/repo/repository2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/03 to old ns http://schemas.android.com/sdk/android/repo/repository2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/03 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/02 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01
Warning: unexpected element (uri:"", local:"base-extension"). Expected elements are <{}codename>,<{}layoutlib>,<{}api-level>lib/main.dart:30:19: Error: The parameter 'key' can't have a value of 'null' because of its type 'Key', but the implicit default value is 'null'.
 - 'Key' is from 'package:flutter/src/foundation/key.dart' ('/C:/tools/flutter/packages/flutter/lib/src/foundation/key.dart').
Try adding either an explicit non-'null' default value or the 'required' modifier.
  MyHomePage({Key key, this.title}) : super(key: key);
                  ^^^
lib/main.dart:30:29: Error: The parameter 'title' can't have a value of 'null' because of its type 'String', but the implicit default value is 'null'.
Try adding either an explicit non-'null' default value or the 'required' modifier.
  MyHomePage({Key key, this.title}) : super(key: key);
                            ^^^^^
Target kernel_snapshot failed: Exception

It's a sample, I got it working, I'm closing as resolved but this issue remains in tree...