Android Studio的Ionic Build错误。

时间:2017-07-30 06:57:04

标签: android android-studio ionic-framework

我在离子应用程序中进行了功能更改,并在浏览器中通过离子服务进行了测试。一切都很顺利,继续进行离子构建。所以它让我失误了。

I:\myprojects\fizion>ionic package info 30

  id       │ 30
  status   │ FAILED
  platform │ android
  mode     │ debug
  started  │ Jul 30th, 2017 10:32:28

output:

ANDROID_HOME=/opt/android-sdk
JAVA_HOME=/usr/lib/jvm/java-8-oracle
Error: Could not find gradle wrapper within Android SDK. Might need to update your Android SDK.
Looked here: /opt/android-sdk/tools/templates/gradle/wrapper

我不确定其建议升级的Android SDK。矿井或离子云? 好的,我尝试升级我的android studio SDK然后开始其他问题。然后我发出以下命令来传播对android的新变化。

cordova prepare android

我已经构建了.apk文件并在手机中启动了。它崩溃了,所以在模拟器中尝试并得到以下错误。

--------- beginning of crash
07-30 12:18:53.350 3040-3040/com.ionicframework.fizion233539 E/AndroidRuntime: FATAL EXCEPTION: main
                                                                               Process: com.ionicframework.fizion233539, PID: 3040
                                                                               java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.ionicframework.fizion233539/com.ionicframework.fizion233539.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "com.ionicframework.fizion233539.MainActivity" on path: DexPathList[[zip file "/data/app/com.ionicframework.fizion233539-1/base.apk"],nativeLibraryDirectories=[/data/app/com.ionicframework.fizion233539-1/lib/x86_64, /vendor/lib64, /system/lib64]]
                                                                                   at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2327)
                                                                                   at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
                                                                                   at android.app.ActivityThread.-wrap11(ActivityThread.java)
                                                                                   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
                                                                                   at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                                   at android.os.Looper.loop(Looper.java:148)
                                                                                   at android.app.ActivityThread.main(ActivityThread.java:5417)
                                                                                   at java.lang.reflect.Method.invoke(Native Method)
                                                                                   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
                                                                                   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
                                                                                Caused by: java.lang.ClassNotFoundException: Didn't find class "com.ionicframework.fizion233539.MainActivity" on path: DexPathList[[zip file "/data/app/com.ionicframework.fizion233539-1/base.apk"],nativeLibraryDirectories=[/data/app/com.ionicframework.fizion233539-1/lib/x86_64, /vendor/lib64, /system/lib64]]
                                                                                   at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
                                                                                   at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
                                                                                   at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
                                                                                   at android.app.Instrumentation.newActivity(Instrumentation.java:1067)
                                                                                   at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2317)
                                                                                   at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476) 
                                                                                   at android.app.ActivityThread.-wrap11(ActivityThread.java) 
                                                                                   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344) 
                                                                                   at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                                                   at android.os.Looper.loop(Looper.java:148) 
                                                                                   at android.app.ActivityThread.main(ActivityThread.java:5417) 
                                                                                   at java.lang.reflect.Method.invoke(Native Method) 
                                                                                   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) 
                                                                                   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 
                                                                                Suppressed: java.lang.NoClassDefFoundError: com.ionicframework.fizion233539.MainActivity
                                                                                   at dalvik.system.DexFile.defineClassNative(Native Method)
                                                                                   at dalvik.system.DexFile.defineClass(DexFile.java:226)
                                                                                   at dalvik.system.DexFile.loadClassBinaryName(DexFile.java:219)
                                                                                   at dalvik.system.DexPathList.findClass(DexPathList.java:338)
                                                                                   at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:54)
                                                                                        ... 13 more
                                                                                Suppressed: java.lang.ClassNotFoundException: com.ionicframework.fizion233539.MainActivity
                                                                                   at java.lang.Class.classForName(Native Method)
                                                                                   at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
                                                                                   at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
                                                                                   at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
                                                                                        ... 12 more
                                                                                Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available
07-30 12:18:53.352 1584-1596/system_process W/ActivityManager:   Force finishing activity com.ionicframework.fizion233539/.MainActivity

我的清单文件:

<?xml version='1.0' encoding='utf-8'?>
<manifest android:hardwareAccelerated="true" android:versionCode="1" android:versionName="0.0.1" package="com.ionicframework.fizion233539" xmlns:android="http://schemas.android.com/apk/res/android">
    <supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" />
    <uses-permission android:name="android.permission.INTERNET" />
    <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" />
    <application android:hardwareAccelerated="true" android:icon="@drawable/icon" android:label="@string/app_name" android:supportsRtl="true">
        <activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:label="@string/activity_name" android:launchMode="singleTop" android:name="MainActivity" android:theme="@android:style/Theme.DeviceDefault.NoActionBar" android:windowSoftInputMode="adjustResize">
            <intent-filter android:label="@string/launcher_name">
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
            <intent-filter android:autoVerify="true">
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <data android:host="https://hs7pj.app.goo.gl/" android:scheme="https" />
            </intent-filter>
            <intent-filter android:autoVerify="true">
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <data android:host="fizion-f4286.firebaseapp.com" android:path="/__/auth/callback" android:scheme="https" />
            </intent-filter>
        </activity>
    </application>
    <uses-sdk android:minSdkVersion="16" android:targetSdkVersion="23" />
    <uses-feature android:name="android.hardware.location.gps" />
</manifest>

我一直在经历许多SO帖子并尝试过许多但没有成功的事情。 我很高兴分享我的android studio配置截图。我确信这是由于android studio的升级,但在哪里破解它。

有人可以指导我,我被封锁了。

1 个答案:

答案 0 :(得分:0)

我的android工作室向我展示了以下帖子中提到的警告。所以我忽略了它。但这是罪魁祸首并解决了这个问题。

Android, IntelliJ Idea, changing module type