1
我嘗試使用庫NCHART3D的Android編譯庫錯誤
我build.gradle
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.example.android.test3dchart"
minSdkVersion 16
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
compile files('libs/NChart3D.jar')
}
和logcat的打印:
Couldn't load nchart3d from loader dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.example.android.test3dchart-2.apk"],nativeLibraryDirectories=[/data/app-lib/com.example.android.test3dchart-2, /vendor/lib, /system/lib]]]: findLibrary returned null
01-15 13:29:50.177 2793-2793/com.example.android.chart D/dalvikvm﹕ Late-enabling CheckJNI
01-15 13:29:50.267 2793-2793/com.example.android.chart W/dalvikvm﹕ Exception Ljava/lang/UnsatisfiedLinkError; thrown while initializing Lcom/nulana/NChart/NChartView;
01-15 13:29:50.267 2793-2793/com.example.android.chart W/dalvikvm﹕ Class init failed in Constructor.constructNative (Lcom/nulana/NChart/NChartView;)
01-15 13:29:50.267 2793-2793/com.example.android.chart D/AndroidRuntime﹕ Shutting down VM
01-15 13:29:50.267 2793-2793/com.example.android.chart W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0x415778b0)
01-15 13:29:50.277 2793-2793/com.example.android.chart E/AndroidRuntime﹕ FATAL EXCEPTION: main
UPDATE 在XML預覽
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<com.nulana.NChart.NChartView
android:id="@+id/surface"
android:layout_height="fill_parent"
android:layout_width="fill_parent"/>
</LinearLayout>
呈現問題無法找到以下類: - com.nulana.NChart.NChartView(修復構建路徑,創建類) 提示:嘗試構建項目。
IM嘗試:依賴{ 編譯文件樹(DIR: '庫',包括:[ '的* .jar']) 編譯「com.android.support:appcompat- v7:21.0.3' }沒有工作:/ – Luis 2015-01-15 19:14:21
即時更新問題... – Luis 2015-01-15 19:15:48
@Luis我的猜測是你沒有正確的項目結構。我下載了NChart3D庫並嘗試了一個演示項目,它沒有任何錯誤或交戰。我更新了我的答案,結帳圖片,並確保您有正確的項目結構 – Vilen 2015-01-16 07:54:04