1
我真的面臨這個奇怪的問題,我的啓動活動沒有找到,當我運行應用程序,但代碼和其他一切似乎很好。我正在使用Android Studio 2.2。未找到啓動活動RuntimeException:無法實例化活動ComponentInfo ClassNotFoundException
我也試圖運行它與以前的android工作室,但同樣的問題。這是錯誤日誌。
07-15 03:12:35.324 32248-32248/indian.railway.app E/AndroidRuntime: FATAL EXCEPTION: main
Process: indian.railway.app, PID: 32248
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{indian.railway.app/indian.railway.app.LaunchActivity}: java.lang.ClassNotFoundException: Didn't find class "indian.railway.app.LaunchActivity" on path: DexPathList[[zip file "/data/app/indian.railway.app-3.apk"],nativeLibraryDirectories=[/data/app-lib/indian.railway.app-3, /vendor/lib, /system/lib]]
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2313)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2500)
at android.app.ActivityThread.access$900(ActivityThread.java:171)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1309)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:146)
at android.app.ActivityThread.main(ActivityThread.java:5679)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1291)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1107)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: Didn't find class "indian.railway.app.LaunchActivity" on path: DexPathList[[zip file "/data/app/indian.railway.app-3.apk"],nativeLibraryDirectories=[/data/app-lib/indian.railway.app-3, /vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:67)
at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
at android.app.Instrumentation.newActivity(Instrumentation.java:1067)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2304)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2500)
at android.app.ActivityThread.access$900(ActivityThread.java:171)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1309)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:146)
at android.app.ActivityThread.main(ActivityThread.java:5679)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1291)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1107)
at dalvik.system.NativeStart.main(Native Method)
我的清單
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="indian.railway.app">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<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_WIFI_STATE"/>
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<application
android:name=".AppController"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/Theme.AppCompat.Light.DarkActionBar"
>
<activity
android:name="indian.railway.app.LaunchActivity"
android:label="@string/app_name"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".PNRActivity"
android:label="@string/pnr_status"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateHidden" />
<activity
android:name=".MoreOptions"
android:label="More Options"
android:screenOrientation="portrait" />
<activity
android:name=".TrainBetween"
android:label="Between stations"
android:screenOrientation="portrait" />
<activity
android:name=".TrainBwResult"
android:label="Between stations"
android:screenOrientation="portrait" />
<activity
android:name=".TrainSearch"
android:label="@string/train_search"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateHidden" />
<activity
android:name=".ScheduleActivity"
android:label="@string/train_schedule"
android:screenOrientation="portrait" />
<activity
android:name=".Wallet"
android:label="Ticket Wallet"
android:screenOrientation="portrait" />
<activity
android:name=".WalletPNR"
android:label="Wallet PNR"
android:screenOrientation="portrait" />
<activity
android:name=".BerthMap"
android:label="Berth Finder"
android:screenOrientation="portrait" />
<activity
android:name=".CurrentBooking"
android:label="Current Booking"
android:screenOrientation="portrait" />
<activity
android:name=".LiveTrain"
android:label="@string/spot_my_train"
android:screenOrientation="portrait" />
<activity
android:name=".AvailActivity"
android:label="Availability"
android:screenOrientation="portrait" />
<activity
android:name=".LiveStation"
android:label="@string/station_status"
android:screenOrientation="portrait" />
<activity
android:name=".FareEnquiry"
android:label="Fare Enquiry"
android:screenOrientation="portrait" />
<activity
android:name=".CancelledTrains"
android:label="Cancelled Trains"
android:screenOrientation="portrait" />
<activity
android:name=".ReschTrains"
android:label="Rescheduled Trains"
android:screenOrientation="portrait" />
<activity
android:name=".DivertedTrains"
android:label="Diverted Trains"
android:screenOrientation="portrait" />
<activity
android:name=".WebView"
android:label="Site"
android:screenOrientation="portrait" />
<activity
android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
android:theme="@android:style/Theme.Translucent" />
<activity
android:name=".PrivacyPolicyWebView"
android:label="Privacy Policy"
android:screenOrientation="portrait" />
<activity
android:name=".MyLastLocation"
android:label="Last Stop"
android:exported="true"
android:screenOrientation="portrait" />
<service
android:name="anagog.pd.service.MobilityService"
android:process=":remote">
<intent-filter>
<action android:name="anagog.pd.service.MobilityService" />
</intent-filter>
</service>
<receiver android:name="anagog.pd.service.StartOnBoot">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"/>
<category android:name="android.intent.category.HOME"/>
</intent-filter>
</receiver>
<receiver android:name="anagog.pd.service.AlarmReceiver">
</receiver>
<receiver android:name="anagog.pd.service.StartOnUser">
<intent-filter>
<action android:name="android.intent.action.USER_PRESENT"/>
</intent-filter>
</receiver>
<receiver android:name=".LocationReceiver">
<intent-filter>
<action android:name="anagog.pd.service.intent.PARKING_UPDATE" />
</intent-filter>
</receiver>
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyAE2NXCsOBlN-dr1HmMD8HZ0miu0EQh66U"
/>
</application>
我的搖籃文件。
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "24.0.0"
dexOptions {
javaMaxHeapSize "4g"
}
defaultConfig {
applicationId "indian.railway.app"
minSdkVersion 9
targetSdkVersion 24
versionCode 3
versionName "3.0"
multiDexEnabled true
ndk
{
moduleName "HelloJNI"
}
sourceSets.main
{
jni.srcDirs = []
jniLibs.srcDirs "src/main/libs"
}
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:24.0.0'
compile 'com.github.navasmdc:MaterialDesign:[email protected]'
compile 'com.google.android.gms:play-services:9.2.1'
}
configurations {
all*.exclude group: 'com.google.firebase', module: 'firebase-common'
}
下水活動
package indian.railway.app;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.drawable.ColorDrawable;
import android.net.Uri;
import android.os.Bundle;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
import com.google.android.gms.ads.AdListener;
import com.google.android.gms.ads.AdView;
import com.google.android.gms.ads.InterstitialAd;
public class LaunchActivity extends AppCompatActivity implements OnClickListener {
private SharedPreferences sp;
ConnectionDetector cd;
ActionBar ab;
你找到了解決方案嗎? – Lichtamberg