Android 库 card.io 在 Moto X 2nd Gen 上跳过相机而不扫描卡
Android library card.io skipping camera and not scanning card on Moto X 2nd Gen
我正在尝试使用出色的 card.io library 来扫描信用卡,就像 Über 在我的 Moto X 2nd Gen 上设法做到的那样,但图书馆无法正常工作。它在 Android 监视器上给出以下输出:
I/card.io: card.io 5.4.2 09/27/2016 11:38:46 -0500
E/card.io: Failed to load native library: dlopen failed: cannot locate symbol "__aeabi_memcpy"
referenced by "/data/app/br.com.feliperochamachado.cardscantest-2/lib/arm/libcardioDecider.so"...
I/card.io: Processor not Supported. Skipping camera.
由于 Über 在 phone 上确实可以正常工作,并且它确实使用了 card.io,我认为这是我的设置问题,但它是一个非常简单的测试应用程序,只能尝试重现准系统指南以使其正常工作。这是我的 gradle.build 文件:
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "24.0.0"
defaultConfig {
applicationId "br.com.feliperochamachado.cardscantest"
minSdkVersion 19
targetSdkVersion 24
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:24.1.1'
compile 'io.card:android-sdk:5.4.2'
testCompile 'junit:junit:4.12'
}
这是我的 manifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="br.com.feliperochamachado.cardscantest">
<!-- Permission to vibrate - recommended, allows vibration feedback on scan -->
<uses-permission android:name="android.permission.VIBRATE" />
<!-- Permission to use camera - required -->
<uses-permission android:name="android.permission.CAMERA" />
<!-- Camera features - recommended -->
<uses-feature android:name="android.hardware.camera" android:required="false" />
<uses-feature android:name="android.hardware.camera.autofocus" android:required="false" />
<uses-feature android:name="android.hardware.camera.flash" android:required="false" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<!-- Activities responsible for gathering payment info -->
<activity android:name="io.card.payment.CardIOActivity" android:configChanges="keyboardHidden|orientation" />
<activity android:name="io.card.payment.DataEntryActivity" />
</application>
</manifest>
调用扫描activity的代码如下:
public void onScanPress(View v) {
Intent scanIntent = new Intent(this, CardIOActivity.class);
// customize these values to suit your needs.
scanIntent.putExtra(CardIOActivity.EXTRA_REQUIRE_EXPIRY, true); // default: false
scanIntent.putExtra(CardIOActivity.EXTRA_REQUIRE_CVV, false); // default: false
scanIntent.putExtra(CardIOActivity.EXTRA_REQUIRE_POSTAL_CODE, false); // default: false
// MY_SCAN_REQUEST_CODE is arbitrary and is only used within this activity.
startActivityForResult(scanIntent, MY_SCAN_REQUEST_CODE);
}
而且我的布局很简单:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:orientation="vertical"
tools:context="br.com.feliperochamachado.cardscantest.MainActivity">
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Scan Card"
android:onClick="onScanPress"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!" />
</LinearLayout>
单击该按钮会将上述警告写入 Android 监视器,完全跳过使用相机,而是显示数据输入表单。
我找不到问题所在。也许库 SDK 没有捆绑所需的库,但我什至不知道去哪里查看!
将 SDK 中的 SampleApp 导入 Android Studio 2.2.2 得到相同的结果!
我评论了 card.io github 项目的两个问题:
- https://github.com/card-io/card.io-Android-SDK/issues/166
- https://github.com/card-io/card.io-Android-source/issues/100
示例应用在第一代 Moto X 设备上运行良好。
由于 ÜBER 在我的设备上运行正常,我尝试降级库版本并且它在 5.4.0 版本中运行正常。只需将我的 gradle 依赖关系更改为:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:24.1.1'
compile 'io.card:android-sdk:5.4.2'
testCompile 'junit:junit:4.12'
}
我将在 github 上对 card.io 的问题跟踪器提供此反馈。
编辑:它也适用于 5.4.1 版!
我正在尝试使用出色的 card.io library 来扫描信用卡,就像 Über 在我的 Moto X 2nd Gen 上设法做到的那样,但图书馆无法正常工作。它在 Android 监视器上给出以下输出:
I/card.io: card.io 5.4.2 09/27/2016 11:38:46 -0500
E/card.io: Failed to load native library: dlopen failed: cannot locate symbol "__aeabi_memcpy"
referenced by "/data/app/br.com.feliperochamachado.cardscantest-2/lib/arm/libcardioDecider.so"...
I/card.io: Processor not Supported. Skipping camera.
由于 Über 在 phone 上确实可以正常工作,并且它确实使用了 card.io,我认为这是我的设置问题,但它是一个非常简单的测试应用程序,只能尝试重现准系统指南以使其正常工作。这是我的 gradle.build 文件:
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "24.0.0"
defaultConfig {
applicationId "br.com.feliperochamachado.cardscantest"
minSdkVersion 19
targetSdkVersion 24
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:24.1.1'
compile 'io.card:android-sdk:5.4.2'
testCompile 'junit:junit:4.12'
}
这是我的 manifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="br.com.feliperochamachado.cardscantest">
<!-- Permission to vibrate - recommended, allows vibration feedback on scan -->
<uses-permission android:name="android.permission.VIBRATE" />
<!-- Permission to use camera - required -->
<uses-permission android:name="android.permission.CAMERA" />
<!-- Camera features - recommended -->
<uses-feature android:name="android.hardware.camera" android:required="false" />
<uses-feature android:name="android.hardware.camera.autofocus" android:required="false" />
<uses-feature android:name="android.hardware.camera.flash" android:required="false" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<!-- Activities responsible for gathering payment info -->
<activity android:name="io.card.payment.CardIOActivity" android:configChanges="keyboardHidden|orientation" />
<activity android:name="io.card.payment.DataEntryActivity" />
</application>
</manifest>
调用扫描activity的代码如下:
public void onScanPress(View v) {
Intent scanIntent = new Intent(this, CardIOActivity.class);
// customize these values to suit your needs.
scanIntent.putExtra(CardIOActivity.EXTRA_REQUIRE_EXPIRY, true); // default: false
scanIntent.putExtra(CardIOActivity.EXTRA_REQUIRE_CVV, false); // default: false
scanIntent.putExtra(CardIOActivity.EXTRA_REQUIRE_POSTAL_CODE, false); // default: false
// MY_SCAN_REQUEST_CODE is arbitrary and is only used within this activity.
startActivityForResult(scanIntent, MY_SCAN_REQUEST_CODE);
}
而且我的布局很简单:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:orientation="vertical"
tools:context="br.com.feliperochamachado.cardscantest.MainActivity">
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Scan Card"
android:onClick="onScanPress"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!" />
</LinearLayout>
单击该按钮会将上述警告写入 Android 监视器,完全跳过使用相机,而是显示数据输入表单。
我找不到问题所在。也许库 SDK 没有捆绑所需的库,但我什至不知道去哪里查看!
将 SDK 中的 SampleApp 导入 Android Studio 2.2.2 得到相同的结果!
我评论了 card.io github 项目的两个问题:
- https://github.com/card-io/card.io-Android-SDK/issues/166
- https://github.com/card-io/card.io-Android-source/issues/100
示例应用在第一代 Moto X 设备上运行良好。
由于 ÜBER 在我的设备上运行正常,我尝试降级库版本并且它在 5.4.0 版本中运行正常。只需将我的 gradle 依赖关系更改为:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:24.1.1'
compile 'io.card:android-sdk:5.4.2'
testCompile 'junit:junit:4.12'
}
我将在 github 上对 card.io 的问题跟踪器提供此反馈。
编辑:它也适用于 5.4.1 版!