Unact / yandex_mapkit

Flutter implementation of YandexMapkit
MIT License
135 stars 148 forks source link

При запуске приложения в Visula Studio Code(Flutter) выводит "Exited(1)" в консоли #60

Closed YaCubeK closed 3 years ago

YaCubeK commented 3 years ago

При попытке запуска приложения выводит Exited(1) и никакой ошибки не выводиться. Не знаю почему это происходит, это произошло когда добавил Yandex MapKit в проект, а до этого запускался спокойно. Данный код снизу уже отдельный проект для теста.

android/app/build.gradle:

dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.yandex.android:mapkit:3.4.0'
implementation 'com.yandex.android:search:3.4.0'
}

android/app/src/main/AndroidManifest.xml:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.yandex_mapkit_example">
<!-- io.flutter.app.FlutterApplication is an android.app.Application that
     calls FlutterMain.startInitialization(this); in its onCreate method.
     In most cases you can leave this as-is, but you if you want to provide
     additional functionality it is fine to subclass or reimplement
     FlutterApplication and put your custom class here. -->
     **<uses-permission android:name="android.permission.INTERNET">
     <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION">**
<application
    android:name="io.flutter.app.FlutterApplication"
    android:label="yandex_mapkit_example"
    android:icon="@mipmap/ic_launcher">
    <activity
        android:name=".MainActivity"
        android:launchMode="singleTop"
        android:theme="@style/LaunchTheme"
        android:configChanges="orientation|keyboardHidden|keyboard
        |screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
        android:hardwareAccelerated="true"
        android:windowSoftInputMode="adjustResize">
        <!-- Specifies an Android theme to apply to this Activity as soon as
             the Android process has started. This theme is visible to the user
             while the Flutter UI initializes. After that, this theme continues
             to determine the Window background behind the Flutter UI. -->
        <meta-data
          android:name="io.flutter.embedding.android.NormalTheme"
          android:resource="@style/NormalTheme"
          />
        <!-- Displays an Android View that continues showing the launch screen
             Drawable until Flutter paints its first frame, then this splash
             screen fades out. A splash screen is useful to avoid any visual
             gap between the end of Android's launch screen and the painting of
             Flutter's first frame. -->
        <meta-data
          android:name="io.flutter.embedding.android.SplashScreenDrawable"
          android:resource="@drawable/launch_background"
          />
        <intent-filter>
            <action android:name="android.intent.action.MAIN"/>
            <category android:name="android.intent.category.LAUNCHER"/>
        </intent-filter>
    </activity>
    <!-- Don't delete the meta-data below.
         This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
    <meta-data
        android:name="flutterEmbedding"
        android:value="2" />
</application>
</manifest>

MainActivity.Kt: package com.example.yandex_mapkit_example

import androidx.annotation.NonNull;
import io.flutter.embedding.android.FlutterActivity
import io.flutter.embedding.engine.FlutterEngine
import io.flutter.plugins.GeneratedPluginRegistrant
import com.yandex.mapkit.MapKitFactory

class MainActivity: FlutterActivity() {
override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) {
    GeneratedPluginRegistrant.registerWith(flutterEngine);
    MapKitFactory.setApiKey("My-Api-Key")
}
}

Использование в приложении:

 import 'package:flutter/material.dart';
 import 'package:yandex_mapkit/yandex_mapkit.dart';

void main() {
runApp(MaterialApp(
home: MapScreen(),
));
}

class MapScreen extends StatefulWidget {
MapScreen({Key key}) : super(key: key);

@override
_MapScreenState createState() => _MapScreenState();
}

class _MapScreenState extends State<MapScreen> {
@override
Widget build(BuildContext context) {
return YandexMap();
}
}

Что нужно сделать, чтобы решить данную проблему?

DCrow commented 3 years ago

Здравствуйте!

Просьба еще приложить flutter doctor -v и pubspec.yaml. Работает ли у вас приложение пример из репозитория?

YaCubeK commented 3 years ago

pubspec.yaml:

 dependencies:
 flutter:
 sdk: flutter
 yandex_mapkit: ^0.4.0

flutter doctor -v:

[√] Flutter (Channel stable, 1.20.2, on Microsoft Windows [Version 10.0.18363.1082], locale
ru-RU)
• Flutter version 1.20.2 at C:\Users\rahim\flutter
• Framework revision bbfbf1770c (8 weeks ago), 2020-08-13 08:33:09 -0700
• Engine revision 9d5b21729f
• Dart version 2.9.1

[√] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
• Android SDK at C:\Users\rahim\AppData\Local\Android\sdk
• Platform android-30, build-tools 30.0.2
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
• All Android licenses accepted.

[√] Android Studio (version 4.0)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 50.0.1
• Dart plugin version 193.7547
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)

[√] VS Code (version 1.49.3)
• VS Code at C:\Users\rahim\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.15.0

[!] Connected device
! No devices available

! Doctor found issues in 1 category.

Приложения запускается по примеру. Единственное что в моем проекте отличается от примера это то, что MainActivity написан на Kotlin. Есть ли в этом разница, или придется переписывать проект чтобы native code был Java? Если да то как?

DCrow commented 3 years ago

Нет, разницы в чем написано приложение нет. Приложение будет работать и на Java, и на Kotlin.

И все таки, приложение пример в проекте запускается или нет?

Также вижу, что у вас указано

implementation 'com.yandex.android:mapkit:3.4.0'
implementation 'com.yandex.android:search:3.4.0'

А должно быть

implementation 'com.yandex.android:mapkit:3.5.0'
implementation 'com.yandex.android:search:3.5.0'

И еще просьба приложить flutter run --verbose

YaCubeK commented 3 years ago

Да работает отлично по примеру. flutter run --verbose:

[ +149 ms] executing: [C:\Users\rahim\flutter/] git -c log.showSignature=false log -n 1
--pretty=format:%H
[  +69 ms] Exit code 0 from: git -c log.showSignature=false log -n 1 --pretty=format:%H
[   +1 ms] bbfbf1770cca2da7c82e887e4e4af910034800b6
[        ] executing: [C:\Users\rahim\flutter/] git tag --contains HEAD
[ +287 ms] Exit code 0 from: git tag --contains HEAD
[   +1 ms] 1.20.2
       1.20.3
       1.20.4
[  +13 ms] executing: [C:\Users\rahim\flutter/] git rev-parse --abbrev-ref --symbolic @{u}
[  +38 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{u}
[   +1 ms] origin/stable
[        ] executing: [C:\Users\rahim\flutter/] git ls-remote --get-url origin
[  +32 ms] Exit code 0 from: git ls-remote --get-url origin
[   +1 ms] https://github.com/flutter/flutter.git
[  +79 ms] executing: [C:\Users\rahim\flutter/] git rev-parse --abbrev-ref HEAD
[  +35 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
[   +1 ms] stable
[  +70 ms] Artifact Instance of 'AndroidMavenArtifacts' is not required, skipping update.
[   +1 ms] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping
update.
[  +12 ms] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping
update.
[   +2 ms] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.        
[        ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[   +4 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[   +1 ms] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.      
[   +9 ms] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[   +9 ms] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.  
[   +1 ms] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.  
[        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update. 
[   +3 ms] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update. 
[  +23 ms] executing: C:\Users\rahim\AppData\Local\Android\sdk\platform-tools\adb.exe devices
-l
[  +49 ms] List of devices attached
[   +5 ms] Artifact Instance of 'MaterialFonts' is not required, skipping update.
[   +9 ms] Artifact Instance of 'GradleWrapper' is not required, skipping update.
[   +1 ms] Artifact Instance of 'AndroidMavenArtifacts' is not required, skipping update.     
[        ] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping       
update.
[   +1 ms] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping     
update.
[   +1 ms] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.        
[        ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[  +12 ms] Artifact Instance of 'FlutterSdk' is not required, skipping update.
[        ] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.    
[        ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.      
[        ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.      
[        ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.  
[        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.  
[  +12 ms] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[   +1 ms] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update. 
[        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[  +12 ms] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FontSubsetArtifacts' is not required, skipping update.       
[  +61 ms] No supported devices connected.
[  +17 ms] "flutter run" took 275ms.
**[  +65 ms] 
       #0      throwToolExit (package:flutter_tools/src/base/common.dart:14:3)
       #1      RunCommand.validateCommand
(package:flutter_tools/src/commands/run.dart:343:7)
       <asynchronous suspension>
       #2      FlutterCommand.verifyThenRunCommand
       (package:flutter_tools/src/runner/flutter_command.dart:836:11)
       <asynchronous suspension>
       #3      FlutterCommand.run.<anonymous closure>
       (package:flutter_tools/src/runner/flutter_command.dart:741:33)
       <asynchronous suspension>
       #4      FlutterCommand.run.<anonymous closure>
       (package:flutter_tools/src/runner/flutter_command.dart)
       #5      AppContext.run.<anonymous closure>
       (package:flutter_tools/src/base/context.dart:150:29)
       #6      _rootRun (dart:async/zone.dart:1190:13)
       #7      _CustomZone.run (dart:async/zone.dart:1093:19)
       #8      _runZoned (dart:async/zone.dart:1630:10)
       #9      runZoned (dart:async/zone.dart:1550:10)
       #10     AppContext.run (package:flutter_tools/src/base/context.dart:149:18)        
       #11     FlutterCommand.run
 (package:flutter_tools/src/runner/flutter_command.dart:730:20)
       #12     CommandRunner.runCommand (package:args/command_runner.dart:197:27)
       #13     FlutterCommandRunner.runCommand.<anonymous closure>
       (package:flutter_tools/src/runner/flutter_command_runner.dart:332:21)
       #14     _rootRunUnary (dart:async/zone.dart:1198:47)
       #15     _CustomZone.runUnary (dart:async/zone.dart:1100:19)
       #16     _FutureListener.handleValue (dart:async/future_impl.dart:143:18)
       #17     Future._propagateToListeners.handleValueCallback
(dart:async/future_impl.dart:696:45)
       #18     Future._propagateToListeners (dart:async/future_impl.dart:725:32)
       #19     Future._completeWithValue (dart:async/future_impl.dart:529:5)
       #20     _AsyncAwaitCompleter.complete (dart:async-patch/async_patch.dart:40:15)    
       #21     _completeOnAsyncReturn (dart:async-patch/async_patch.dart:311:13)
       #22     FlutterVersion.checkFlutterVersionFreshness
(package:flutter_tools/src/version.dart)
       #23     _rootRunUnary (dart:async/zone.dart:1198:47)
       #24     _CustomZone.runUnary (dart:async/zone.dart:1100:19)
       #25     _FutureListener.handleValue (dart:async/future_impl.dart:143:18)
       #26     Future._propagateToListeners.handleValueCallback
(dart:async/future_impl.dart:696:45)
       #27     Future._propagateToListeners (dart:async/future_impl.dart:725:32)
       #28     Future._completeWithValue (dart:async/future_impl.dart:529:5)
       #29     Future._asyncCompleteWithValue.<anonymous closure>
(dart:async/future_impl.dart:567:7)
       #30     _rootRun (dart:async/zone.dart:1190:13)
       #32     _CustomZone.runGuarded (dart:async/zone.dart:997:7)
       #33     _CustomZone.bindCallbackGuarded.<anonymous closure>
(dart:async/zone.dart:1037:23)
       #34     _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
       #35     _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
       #36     _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:118:13)           #37     
_RawReceivePortImpl._handleMessage
(dart:isolate-patch/isolate_patch.dart:169:5)**

[ +341 ms] ensureAnalyticsSent: 256ms
[   +3 ms] Running shutdown hooks
[   +8 ms] Shutdown hooks complete
[   +1 ms] exiting with code 1
PS C:\Users\rahim\Flutter projects\yandex_mapkit_example> flutter run --verbose 
[ +148 ms] executing: [C:\Users\rahim\flutter/] git -c log.showSignature=false log -n 1
--pretty=format:%H
[  +68 ms] Exit code 0 from: git -c log.showSignature=false log -n 1 --pretty=format:%H
[   +1 ms] bbfbf1770cca2da7c82e887e4e4af910034800b6
[   +1 ms] executing: [C:\Users\rahim\flutter/] git tag --contains HEAD
[ +293 ms] Exit code 0 from: git tag --contains HEAD
[   +1 ms] 1.20.2
       1.20.3
       1.20.4
[  +13 ms] executing: [C:\Users\rahim\flutter/] git rev-parse --abbrev-ref --symbolic @{u}
[  +54 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{u}
[        ] origin/stable
[        ] executing: [C:\Users\rahim\flutter/] git ls-remote --get-url origin
[  +42 ms] Exit code 0 from: git ls-remote --get-url origin
[   +1 ms] https://github.com/flutter/flutter.git
[  +81 ms] executing: [C:\Users\rahim\flutter/] git rev-parse --abbrev-ref HEAD
 [  +37 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
 [   +1 ms] stable
[  +70 ms] Artifact Instance of 'AndroidMavenArtifacts' is not required, skipping update.
[   +1 ms] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping
update.
[   +1 ms] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping     
update.
[   +1 ms] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.        
[  +17 ms] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[  +16 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[   +9 ms] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[   +1 ms] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.      
[        ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.  
[        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.  
[        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update. 
[   +1 ms] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update. 
[  +24 ms] executing: C:\Users\rahim\AppData\Local\Android\sdk\platform-tools\adb.exe devices
-l
[  +52 ms] List of devices attached
       emulator-5554          device product:sdk_gphone_x86
       model:Android_SDK_built_for_x86 device:generic_x86 transport_id:2
[  +10 ms] C:\Users\rahim\AppData\Local\Android\sdk\platform-tools\adb.exe -s emulator-5554
shell getprop
[  +56 ms] Artifact Instance of 'AndroidMavenArtifacts' is not required, skipping update.
[   +5 ms] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping
update.
[   +1 ms] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.        
[   +1 ms] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[   +4 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[   +9 ms] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.      
[        ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.  
[        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.  
[        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update. 
[        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update. 
[ +148 ms] Found plugin yandex_mapkit at
C:\Users\rahim\flutter\.pub-cache\hosted\pub.dartlang.org\yandex_mapkit-0.4.0\
[  +93 ms] Found plugin yandex_mapkit at
C:\Users\rahim\flutter\.pub-cache\hosted\pub.dartlang.org\yandex_mapkit-0.4.0\
[  +80 ms] "flutter run" took 551ms.
**[  +24 ms] Error parsing LocalFile: 'C:\Users\rahim\Flutter
       projects\yandex_mapkit_example\android\app\src\main\AndroidManifest.xml' Please    
ensure that
       the android manifest is a valid XML document and try again.
 [   +7 ms] 
       #0      throwToolExit (package:flutter_tools/src/base/common.dart:14:3)
       #1      AndroidProject.getEmbeddingVersion
(package:flutter_tools/src/project.dart:843:7)
       #2      _getAndroidEmbeddingVersion (package:flutter_tools/src/plugins.dart:597:26)           #3      
_writeAndroidPluginRegistrant
(package:flutter_tools/src/plugins.dart:622:55)
       #4      injectPlugins (package:flutter_tools/src/plugins.dart:1147:11)
       <asynchronous suspension>
       #5      FlutterProject.ensureReadyForPlatformSpecificTooling
       (package:flutter_tools/src/project.dart:263:11)
       <asynchronous suspension>
       #6      FlutterCommand.verifyThenRunCommand
       (package:flutter_tools/src/runner/flutter_command.dart:843:21)
       <asynchronous suspension>
       #7      FlutterCommand.run.<anonymous closure>
       (package:flutter_tools/src/runner/flutter_command.dart:741:33)
       <asynchronous suspension>
       #8      FlutterCommand.run.<anonymous closure>
       (package:flutter_tools/src/runner/flutter_command.dart)
       #9      AppContext.run.<anonymous closure>
       (package:flutter_tools/src/base/context.dart:150:29)
       #10     _rootRun (dart:async/zone.dart:1190:13)
       #11     _CustomZone.run (dart:async/zone.dart:1093:19)
       #12     _runZoned (dart:async/zone.dart:1630:10)
       #13     runZoned (dart:async/zone.dart:1550:10)
       #14     AppContext.run (package:flutter_tools/src/base/context.dart:149:18)        
       #15     FlutterCommand.run
(package:flutter_tools/src/runner/flutter_command.dart:730:20)
       #16     CommandRunner.runCommand (package:args/command_runner.dart:197:27)
       #17     FlutterCommandRunner.runCommand.<anonymous closure>
       (package:flutter_tools/src/runner/flutter_command_runner.dart:332:21)
       #18     _rootRunUnary (dart:async/zone.dart:1198:47)
       #19     _CustomZone.runUnary (dart:async/zone.dart:1100:19)
       #20     _FutureListener.handleValue (dart:async/future_impl.dart:143:18)
       #21     Future._propagateToListeners.handleValueCallback
(dart:async/future_impl.dart:696:45)
       #22     Future._propagateToListeners (dart:async/future_impl.dart:725:32)
       #23     Future._completeWithValue (dart:async/future_impl.dart:529:5)
       #24     _AsyncAwaitCompleter.complete (dart:async-patch/async_patch.dart:40:15)    
       #25     _completeOnAsyncReturn (dart:async-patch/async_patch.dart:311:13)
       #26     FlutterVersion.checkFlutterVersionFreshness
 (package:flutter_tools/src/version.dart)
       #27     _rootRunUnary (dart:async/zone.dart:1198:47)
       #28     _CustomZone.runUnary (dart:async/zone.dart:1100:19)
       #29     _FutureListener.handleValue (dart:async/future_impl.dart:143:18)
       #30     Future._propagateToListeners.handleValueCallback
(dart:async/future_impl.dart:696:45)
       #31     Future._propagateToListeners (dart:async/future_impl.dart:725:32)
       #32     Future._completeWithValue (dart:async/future_impl.dart:529:5)
       #33     Future._asyncCompleteWithValue.<anonymous closure>
(dart:async/future_impl.dart:567:7)
       #34     _rootRun (dart:async/zone.dart:1190:13)
       #35     _CustomZone.run (dart:async/zone.dart:1093:19)
       #36     _CustomZone.runGuarded (dart:async/zone.dart:997:7)
       #37     _CustomZone.bindCallbackGuarded.<anonymous closure>
 (dart:async/zone.dart:1037:23)
       #38     _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
       #39     _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
       #40     _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:118:13)           #41     
 _RawReceivePortImpl._handleMessage
 (dart:isolate-patch/isolate_patch.dart:169:5)**

[ +329 ms] ensureAnalyticsSent: 253ms
[   +4 ms] Running shutdown hooks
[  +10 ms] Shutdown hooks complete
       **#35     _CustomZone.run (dart:async/zone.dart:1093:19)
       #36     _CustomZone.runGuarded (dart:async/zone.dart:997:7)
       #37     _CustomZone.bindCallbackGuarded.<anonymous closure>
(dart:async/zone.dart:1037:23)
       #38     _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
       #39     _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
       #40     _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:118:13)           #41     
_RawReceivePortImpl._handleMessage
(dart:isolate-patch/isolate_patch.dart:169:5)**

 [ +329 ms] ensureAnalyticsSent: 253ms
 [   +4 ms] Running shutdown hooks
 [  +10 ms] Shutdown hooks complete
 [   +1 ms] exiting with code 1

Подсвеченные красным ошибки в выводе консоли отметил жирными. И правильно ли я написал код на Kotlin?

DCrow commented 3 years ago

Опять же, я имею ввиду нормально запускается ли example приложение из этого репозитория(не ваше приложение)?

Также видно в flutter run --verbose, что у вас возникает ошибка

Error parsing LocalFile: 'C:\Users\rahim\Flutter
       projects\yandex_mapkit_example\android\app\src\main\AndroidManifest.xml' Please    
ensure that
       the android manifest is a valid XML document and try again.

Возможно дело в **

**<uses-permission android:name="android.permission.INTERNET">
     <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION">**
YaCubeK commented 3 years ago

Да я скачал ваш пример и все работает отлично! А ** это использовал чтобы подсветить ошибки жирным. Когда изменял текст там было выделить жирным и этот знак был использован.

YaCubeK commented 3 years ago

Я понял в чем была проблема!

В AndroidManifest.xml вместо:

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>

Я использовал без слеша о закрытии скобки:

<uses-permission android:name="android.permission.INTERNET">
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION">

Но теперь у меня другая проблема, running gradle грузиться очень долго(уже больше часу). И приложение следовательно запускается и грузиться долго. Как можно ее решить?

DCrow commented 3 years ago

Хмм, о слешах не подозревал, что они имеют такой эффект. Добавлю об этом пометку в README.

Долго грузится для вашего проекта, или для тестового приложения? Если для вашего, то возможно вы указали не те версии yandexmapkit в android/app/build.gradle? Вместо 3.5.0 3.4.0 Либо может ваше приложение использует flutter android embedding v1. Есть ли в файле android/app/src/main/AndroidManifest.xml строчка?

<meta-data
        android:name="flutterEmbedding"
        android:value="2" />
YaCubeK commented 3 years ago

Я использую в тестовом приложении. Может все таки проблема в MainActivity.Kt? Да присутствует:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.yandex_mapkit_example">
<!-- io.flutter.app.FlutterApplication is an android.app.Application that
     calls FlutterMain.startInitialization(this); in its onCreate method.
     In most cases you can leave this as-is, but you if you want to provide
     additional functionality it is fine to subclass or reimplement
     FlutterApplication and put your custom class here. -->
     <uses-permission android:name="android.permission.INTERNET"/>
     <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<application
    android:name="io.flutter.app.FlutterApplication"
    android:label="yandex_mapkit_example"
    android:icon="@mipmap/ic_launcher">
    <activity
        android:name=".MainActivity"
        android:launchMode="singleTop"
        android:theme="@style/LaunchTheme"
        android:configChanges="orientation|keyboardHidden|keyboard
        |screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
        android:hardwareAccelerated="true"
        android:windowSoftInputMode="adjustResize">
        <!-- Specifies an Android theme to apply to this Activity as soon as
             the Android process has started. This theme is visible to the user
             while the Flutter UI initializes. After that, this theme continues
             to determine the Window background behind the Flutter UI. -->
        <meta-data
          android:name="io.flutter.embedding.android.NormalTheme"
          android:resource="@style/NormalTheme"
          />
        <!-- Displays an Android View that continues showing the launch screen
             Drawable until Flutter paints its first frame, then this splash
             screen fades out. A splash screen is useful to avoid any visual
             gap between the end of Android's launch screen and the painting of
             Flutter's first frame. -->
        <meta-data
          android:name="io.flutter.embedding.android.SplashScreenDrawable"
          android:resource="@drawable/launch_background"
          />
        <intent-filter>
            <action android:name="android.intent.action.MAIN"/>
            <category android:name="android.intent.category.LAUNCHER"/>
        </intent-filter>
    </activity>
    <!-- Don't delete the meta-data below.
         This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
    <meta-data
        android:name="flutterEmbedding"
        android:value="2" />
</application>
</manifest>
DCrow commented 3 years ago

Нет, если бы была проблема в MainActivity.Kt, то gradle бы зафейлился, а по вашим словам он продолжает собирать.

Проблема вероятно где-то в ваших .build файлах.

Попробуйте перед запуском вызвать flutter clean. Если это не поможет, то пожалуйста выложите ваше тестовое приложения в репозиторий, чтобы можно было это воспроизвести.

YaCubeK commented 3 years ago

Попробовал запустить проект после вызова flutter clean грузился около часа, безуспешно. Залил свой тестовый проект на https://github.com/YaCubeK/yandex_mapkit_example .

DCrow commented 3 years ago

В данном проекте такая ошибка не воспроизводится. Единственную ошибку, которую я нашел это при запуске приложения. Там проблема в MainActivity.kt. Надо MapKitFactory.setApiKey("MY-API-KEY") вызывать до GeneratedPluginRegistrant.registerWith(flutterEngine)

Кроме этого, приложение собирается и запускается нормально.

Возможно эта какая-то проблема у флаттера на Windows. К сожалению у меня нет возможности проверить поведение на Windows.

Если возможно выложите полный результат flutter build apk -v

YaCubeK commented 3 years ago

Только что попробовал поменять местами эти строчки кода, которые вы сказали. Все работает отлично! Спасибо большое! Если не сложно, можете подсказать где можно посмотреть примеры возможности поиска и прокладки маршрута от точки до точки?

DCrow commented 3 years ago

Хорошо что все заработало

Насчет маршрута скорее всего вы о #34. В данный момент такого функционал в проекте нет