这是我的第一篇文章。我的 android 应用程序有问题(关于使用 Wikitude 的增强现实),这就是 logcat 中显示的内容:
03-19 17:04:06.870: E/AndroidRuntime(15789): FATAL EXCEPTION: main
03-19 17:04:06.870: E/AndroidRuntime(15789): java.lang.NoClassDefFoundError: tirocinio.myapp.wikitude.RealtaAumentataActivity
这是处理增强现实的类,或者至少应该这样做:(我只发布了 onCreate() 方法:)
@Override
public void onCreate(Bundle savedInstanceState) {
.....
super.onCreate(savedInstanceState);
setContentView(R.layout.aractivity);
this.architectView = (ArchitectView) this.findViewById(R.id.architectView);
architectView.onCreate(apiKey);
......
}
这是“aractivity”文件xml:
### aractivity.xml ###
<com.wikitude.architect.ArchitectView
android:id="@+id/architectView"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
</com.wikitude.architect.ArchitectView>
这些是进口:
### import ###
import java.io.IOException;
import java.net.URI;
import java.util.ArrayList;
import java.util.List;
import org.apache.http.NameValuePair;
import org.apache.http.client.utils.URLEncodedUtils;
import org.json.JSONArray;
import org.json.JSONException;
import tirocinio.myapp.R;
import tirocinio.myapp.activity.PoiDetailActivity;
import android.app.Activity;
import android.content.Intent;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.media.AudioManager;
import android.os.Bundle;
import android.view.WindowManager;
import android.widget.Toast;
import com.wikitude.architect.ArchitectUrlListener;
import com.wikitude.architect.ArchitectView;
这是我的清单:我认为这是正确的
### Manifest ###
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="tirocinio.myapp"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_GPS" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<uses-library android:name="com.google.android.maps" />
<activity
android:name="tirocinio.myapp.activity.HomeActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="tirocinio.myapp.activity.MappaActivity"
android:label="@string/app_name" />
<activity
android:name="tirocinio.myapp.wikitude.RealtaAumentataActivity"
android:label="@string/app_name" />
</application>
</manifest>
这是构建路径:
### buildpath ###
- maps.jar
- QCAR.jar
- wikitudes.jar
- Android Dipendences
- Google APIs [Android 4.2.2]