OpenFlutter / tobias

AliPay For Flutter.支付宝Flutter插件
Apache License 2.0
696 stars 116 forks source link

添加原生 SDK 问题。 #2

Closed jaggerwang closed 6 years ago

jaggerwang commented 6 years ago

安装 官方文档 里的说明添加了也还是不行。

错误信息:

Launching lib/main_dev.dart on jagger-ip in debug mode...
Automatically signing iOS for device deployment using specified development team in Xcode project: XJ5R3XY5GP
CocoaPods' output:
↳
Preparing
Analyzing dependencies
Inspecting targets to integrate
Using `ARCHS` setting to build architectures of target `Pods-Runner`: (``)
Finding Podfile changes
A tobias
- Flutter
- flutter_alipay
- flutter_webview_plugin
- path_provider
- shared_preferences
- url_launcher
- video_player
Fetching external sources
-> Fetching podspec for `Flutter` from `.symlinks/flutter/ios`
-> Fetching podspec for `flutter_alipay` from `.symlinks/plugins/flutter_alipay/ios`
-> Fetching podspec for `flutter_webview_plugin` from `.symlinks/plugins/flutter_webview_plugin/ios`
-> Fetching podspec for `path_provider` from `.symlinks/plugins/path_provider/ios`
-> Fetching podspec for `shared_preferences` from `.symlinks/plugins/shared_preferences/ios`
-> Fetching podspec for `tobias` from `.symlinks/plugins/tobias/ios`
-> Fetching podspec for `url_launcher` from `.symlinks/plugins/url_launcher/ios`
-> Fetching podspec for `video_player` from `.symlinks/plugins/video_player/ios`
Resolving dependencies of `Podfile`
[!] Unable to find a specification for `OpenAliPaySDK (~> 15.5.5+4)` depended upon by `tobias`
/usr/local/Cellar/cocoapods/1.5.3/libexec/gems/cocoapods-1.5.3/lib/cocoapods/resolver.rb:402:in `find_cached_set'
/usr/local/Cellar/cocoapods/1.5.3/libexec/gems/cocoapods-1.5.3/lib/cocoapods/resolver.rb:372:in `specifications_for_dependency'
/usr/local/Cellar/cocoapods/1.5.3/libexec/gems/cocoapods-1.5.3/lib/cocoapods/resolver.rb:177:in `search_for'
/usr/local/Cellar/cocoapods/1.5.3/libexec/gems/cocoapods-1.5.3/lib/cocoapods/resolver.rb:288:in `block in sort_dependencies'
/usr/local/Cellar/cocoapods/1.5.3/libexec/gems/cocoapods-1.5.3/lib/cocoapods/resolver.rb:281:in `each'
/usr/local/Cellar/cocoapods/1.5.3/libexec/gems/cocoapods-1.5.3/lib/cocoapods/resolver.rb:281:in `sort_by'
/usr/local/Cellar/cocoapods/1.5.3/libexec/gems/cocoapods-1.5.3/lib/cocoapods/resolver.rb:281:in `sort_dependencies'
/usr/local/Cellar/cocoapods/1.5.3/libexec/gems/molinillo-0.6.5/lib/molinillo/delegates/specification_provider.rb:53:in `block in sort_dependencies'
/usr/local/Cellar/cocoapods/1.5.3/libexec/gems/molinillo-0.6.5/lib/molinillo/delegates/specification_provider.rb:70:in `with_no_such_dependency_error_handling'
/usr/local/Cellar/cocoapods/1.5.3/libexec/gems/molinillo-0.6.5/lib/molinillo/delegates/specification_provider.rb:52:in `sort_dependencies'
/usr/local/Cellar/cocoapods/1.5.3/libexec/gems/molinillo-0.6.5/lib/molinillo/resolution.rb:754:in `push_state_for_requirements'
/usr/local/Cellar/cocoapods/1.5.3/libexec/gems/molinillo-0.6.5/lib/molinillo/resolution.rb:746:in `require_nested_dependencies_for'
/usr/local/Cellar/cocoapods/1.5.3/libexec/gems/molinillo-0.6.5/lib/molinillo/resolution.rb:729:in `activate_new_spec'
/usr/local/Cellar/cocoapods/1.5.3/libexec/gems/molinillo-0.6.5/lib/molinillo/resolution.rb:686:in `attempt_to_activate'
/usr/local/Cellar/cocoapods/1.5.3/libexec/gems/molinillo-0.6.5/lib/molinillo/resolution.rb:254:in `process_topmost_state'
/usr/local/Cellar/cocoapods/1.5.3/libexec/gems/molinillo-0.6.5/lib/molinillo/resolution.rb:182:in `resolve'
/usr/local/Cellar/cocoapods/1.5.3/libexec/gems/molinillo-0.6.5/lib/molinillo/resolver.rb:43:in `resolve'
/usr/local/Cellar/cocoapods/1.5.3/libexec/gems/cocoapods-1.5.3/lib/cocoapods/resolver.rb:123:in `resolve'
/usr/local/Cellar/cocoapods/1.5.3/libexec/gems/cocoapods-1.5.3/lib/cocoapods/installer/analyzer.rb:781:in `block in resolve_dependencies'
/usr/local/Cellar/cocoapods/1.5.3/libexec/gems/cocoapods-1.5.3/lib/cocoapods/user_interface.rb:64:in `section'
/usr/local/Cellar/cocoapods/1.5.3/libexec/gems/cocoapods-1.5.3/lib/cocoapods/installer/analyzer.rb:779:in `resolve_dependencies'
/usr/local/Cellar/cocoapods/1.5.3/libexec/gems/cocoapods-1.5.3/lib/cocoapods/installer/analyzer.rb:88:in `analyze'
/usr/local/Cellar/cocoapods/1.5.3/libexec/gems/cocoapods-1.5.3/lib/cocoapods/installer.rb:243:in `analyze'
/usr/local/Cellar/cocoapods/1.5.3/libexec/gems/cocoapods-1.5.3/lib/cocoapods/installer.rb:154:in `block in resolve_dependencies'
/usr/local/Cellar/cocoapods/1.5.3/libexec/gems/cocoapods-1.5.3/lib/cocoapods/user_interface.rb:64:in `section'
/usr/local/Cellar/cocoapods/1.5.3/libexec/gems/cocoapods-1.5.3/lib/cocoapods/installer.rb:153:in `resolve_dependencies'
/usr/local/Cellar/cocoapods/1.5.3/libexec/gems/cocoapods-1.5.3/lib/cocoapods/installer.rb:116:in `install!'
/usr/local/Cellar/cocoapods/1.5.3/libexec/gems/cocoapods-1.5.3/lib/cocoapods/command/install.rb:41:in `run'
/usr/local/Cellar/cocoapods/1.5.3/libexec/gems/claide-1.0.2/lib/claide/command.rb:334:in `run'
/usr/local/Cellar/cocoapods/1.5.3/libexec/gems/cocoapods-1.5.3/lib/cocoapods/command.rb:52:in `run'
/usr/local/Cellar/cocoapods/1.5.3/libexec/gems/cocoapods-1.5.3/bin/pod:55:in `<top (required)>'
/usr/local/Cellar/cocoapods/1.5.3/libexec/bin/pod:22:in `load'
/usr/local/Cellar/cocoapods/1.5.3/libexec/bin/pod:22:in `<main>'
Error output from CocoaPods:
↳
[!] Automatically assigning platform `ios` with version `8.0` on target `Runner` because no platform was specified. Please specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`.
Error running pod install
Exited (sigterm)

Xcode 截图:

image

JarvanMo commented 6 years ago

如果pod search OpenAliPaySDK搜不到就要清pod缓存了。

JarvanMo commented 6 years ago

而且是不需要再配置支付宝sdk的

jaggerwang commented 6 years ago

ok,我试试。另外 Android 怎么配置原生 SDK?官网文档 里的界面跟我用的 Android Studio 3.1 完全不一致。

JarvanMo commented 6 years ago

https://github.com/OpenFlutter/tobias/tree/master/android 看这里就行。另外如果用的是tobias,原生sdk是不需要再做额外配置的。

jaggerwang commented 6 years ago

在 Podfile 最后添加下面内容:

pod 'AlipaySDK-2.0'

然后执行 pod install 报错:

pod install
Analyzing dependencies
Fetching podspec for `Flutter` from `.symlinks/flutter/ios`
Fetching podspec for `flutter_alipay` from `.symlinks/plugins/flutter_alipay/ios`
Fetching podspec for `flutter_webview_plugin` from `.symlinks/plugins/flutter_webview_plugin/ios`
Fetching podspec for `path_provider` from `.symlinks/plugins/path_provider/ios`
Fetching podspec for `shared_preferences` from `.symlinks/plugins/shared_preferences/ios`
Fetching podspec for `tobias` from `.symlinks/plugins/tobias/ios`
Fetching podspec for `url_launcher` from `.symlinks/plugins/url_launcher/ios`
Fetching podspec for `video_player` from `.symlinks/plugins/video_player/ios`
[!] Unable to find a specification for `OpenAliPaySDK (~> 15.5.5+4)` depended upon by `tobias`

[!] Automatically assigning platform `ios` with version `8.0` on target `Runner` because no platform was specified. Please specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`.
JarvanMo commented 6 years ago

是找不到OpenAliPaySDK (~> 15.5.5+4)。。。你添加那些没用。

jaggerwang commented 6 years ago

那还是只能手动安装?

JarvanMo commented 6 years ago

不是。。。。你pod search 能不能搜索到OpenAliPaySDK??????不能的话,要清一下pod缓存

jaggerwang commented 6 years ago

放弃了,集成太麻烦。iOS 的通过 pod 安装成功,但还没测试,Android 的配置啥文档都没有,还要使用 kotlin。

JarvanMo commented 6 years ago

@jaggerwang 使用这个库不需要配置啊。也不需要使用者使用kotlin啊。都配置好了,开箱即用的。

JarvanMo commented 6 years ago

@jaggerwang 你一开始就走进了误区,不知道你为什么要配置原生sdk。tobias已经为用户做好了这些工作。用户需要做的是tobias无法配置的东西。多看demo啊。

jaggerwang commented 6 years ago

@JarvanMo 成功了:)。之前 Android 运行报 OpenAliPaySDK 未找到错误是因为本地的 repo 没有更新,需要先执行 pod repo update 来更新本地仓库。前面你发我的 demo 参考链接里面,有修改 build.gradleAndroidManifest.xml 文件,就照着去配置了,结果编译失败。

另外 AndroidManifest.xml 真的不需要配置权限和 Activity 了?

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="app.tangbole">

    ...
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

    ...
        <activity
            android:name="com.alipay.sdk.app.H5PayActivity"
            android:configChanges="orientation|keyboardHidden|navigation|screenSize"
            android:exported="false"
            android:screenOrientation="behind"
            android:windowSoftInputMode="adjustResize|stateHidden" >
        </activity>
        <activity
            android:name="com.alipay.sdk.app.H5AuthActivity"
            android:configChanges="orientation|keyboardHidden|navigation"
            android:exported="false"
            android:screenOrientation="behind"
            android:windowSoftInputMode="adjustResize|stateHidden" >
        </activity>
    </application>
</manifest>
JarvanMo commented 6 years ago

不需要的。但像<uses-permission android:name="android.permission.READ_PHONE_STATE" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />这种的需要动态申请的权限,还是需要自己去申请的。

JarvanMo commented 6 years ago

前面发的不是demo,是我的Lib。你要自己配置支付宝SDK,所以发的是Lib。demo在example目录下。

jaggerwang commented 6 years ago

多谢!这下总算可以正式关闭了~

jaggerwang commented 6 years ago

另外提个建议,你们的关键词里没有 alipay,导致在 https://pub.dartlang.org 上根本搜索不到,我还是通过 Google 搜索才找到。

JarvanMo commented 6 years ago

@jaggerwang 多谢。