我正在尝试使用精彩的card.io library扫描信用卡,就像Über设法在我的Moto X 2nd Gen上做的那样,图书馆无法正常工作。它在Android Monitor上提供以下输出:
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在同一部手机上运行正常,并且确实使用了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>
调用扫描活动的代码如下:
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会产生相同的结果!
答案 0 :(得分:1)
我对card.io github项目中的两个问题发表了评论:
示例应用程序在Moto X 1st Gen设备上运行良好。
由于Ü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!