Dodanie płatności Przelewy24

0

Chciałem nauczyć się tworzyć proste aplikacje mobilne przy użyciu Flutter-a.
Pierwszą udało mi się stworzyć i uruchomić na telefonie, jednak pojawiły się problemy kiedy chciałem dodać do niej płatności mobilne, a konkretnie przelewy24
https://github.com/przelewy24/p24-mobile-lib-flutter/blob/master/README_pl.md

Paczka zawiera przykład, który próbowałem uruchomić i zobaczyć jak płatność jest realizowana:
https://github.com/przelewy24/p24-mobile-lib-flutter/tree/master/example

Jednak dostaje tylko błędy przy próbie uruchomienia i nie bardzo wiem co z tym zrobić.
Projekt uruchamiam na Ubuntu w VS Code, najpierw wykonuje flutter pub get
w Android Studio sparuję telefon Sony Xperia (Android 13) i VS Code klikam Start Debugging

Taki jest wynik:

Launching lib/main.dart on XQ CC54 in debug mode...
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:
Some problems were found with the configuration of task ':app:compileDebugRenderscript' (type 'RenderscriptCompile').
  - In plugin 'com.android.build.gradle.api.AndroidBasePlugin' type 'com.android.build.gradle.tasks.RenderscriptCompile' method 'useAndroidX()' should not be annotated with: @Input.

    Reason: Input/Output annotations are ignored if they are placed on something else than a getter.

    Reason: A property without annotation isn't considered during up-to-date checking.

    Possible solutions:
      1. Add an input or output annotation.
      2. Mark it as @Internal.

    Please refer to https://docs.gradle.org/7.6.1/userguide/validation_problems.html#missing_annotation for more details about this problem.

* 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 3s
Exception: Gradle task assembleDebug failed with exit code 1

Exited (1).

Nie bardzo wiem co z tym zrobić, może ktoś podpinał kiedyś tą bibliotekę?

0

Spróbuj wejść do katalogu example i wykonać najpierw w konsoli flutter clean a potem flutter create .. Jak nie zadziała to najpierw usuń cały katalog Android i wykonaj to jeszcze raz.

Po drugie, nie próbuj uruchamiać ich przykładu tylko dołącz bibliotekę do swojego projektu i spróbuj jej użyć. Przykład mógł być utworzony w starszym Flutterze i stąd problemy.

0

@gajusz800: zrobiłem jak napisałeś, usunąłem folder Android potem flutter clean, flutter create, flutter pub get i po próbie uruchomienia na Andoidzie dostaje:

Launching lib/main.dart on XQ CC54 in debug mode...

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':p24_sdk:parseDebugLocalResources'.
> Could not resolve all files for configuration ':p24_sdk:androidApis'.
   > Failed to transform android.jar to match attributes {artifactType=android-platform-attr, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}.
      > Execution failed for PlatformAttrTransform: /home/xxx/Android/Sdk/platforms/android-29/android.jar.
         > /home/xxx/Android/Sdk/platforms/android-29/android.jar

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.

Do swojego projektu również próbowałem dołączyć tą bibliotekę. Uruchamiając aplikacje desktopową wszystko startuje, widzę widoki z przykładu ale po kliknięciu czegokolwiek nic się nie dzieje ale z tego co widzę w dokumentacji działa tylko na Android i IOS więc tu chyba nie zadziała.
Przy próbie uruchomienia na Androidzie dostaje:

Launching lib/main.dart on XQ CC54 in debug mode...

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':p24_sdk:parseDebugLocalResources'.
> Could not resolve all files for configuration ':p24_sdk:androidApis'.
   > Failed to transform android.jar to match attributes {artifactType=android-platform-attr, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}.
      > Execution failed for PlatformAttrTransform: /home/xxx/Android/Sdk/platforms/android-29/android.jar.
         > /home/xxx/Android/Sdk/platforms/android-29/android.jar

* 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 19s
Exception: Gradle task assembleDebug failed with exit code 1

Exited (1).

Czyli to samo co na próbie uruchomienia przykładu po wykonaniu kroków które opisałeś.

0

Udało się uruchomić, w moim przypadku był problem z wersjami. Usnąłem Fluttera, Android Sdk, zainstalowałem najnowsze wersję i działa.

1 użytkowników online, w tym zalogowanych: 0, gości: 1