我在解析有关我正在运行项目的设备时遇到了一些问题。
首先我尝试让Parse在我的项目上工作,但我总是遇到一些与我正在使用的设备有关的问题,所以我决定采用ParseStarterProject(here)。
我用Android Studio打开build.gradle,在检查它是否在我的两个Android设备上工作后,我修改了AndroidManifest.xml和build.gradle文件以适应我的第一个项目。
AndroidManifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (c) 2015-present, Parse, LLC.
~ All rights reserved.
~
~ This source code is licensed under the BSD-style license found in the
~ LICENSE file in the root directory of this source tree. An additional grant
~ of patent rights can be found in the PATENTS file in the same directory.
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:largeHeap="true"
package="com.parse.starter">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:name=".StarterApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme"
tools:replace="android:theme">
>
<meta-data
android:name="com.parse.APPLICATION_ID"
android:value="@string/parse_app_id" />
<meta-data
android:name="com.parse.CLIENT_KEY"
android:value="@string/parse_client_key" />
<activity
android:name=".MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
Build.gradle(项目)
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
mavenCentral()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.1'
}
}
allprojects {
repositories {
mavenCentral()
jcenter()
}
}
ext {
compileSdkVersion = 23
buildToolsVersion = "23.0.0"
minSdkVersion = 16
targetSdkVersion = 23
}
Build.gradle(模块)
apply plugin: 'com.android.application'
apply plugin: 'com.parse'
buildscript {
repositories {
jcenter()
mavenCentral()
maven { url 'https://maven.parse.com/repo' }
}
dependencies {
classpath 'com.parse.tools:gradle:1.+'
}
}
android {
compileSdkVersion 23
buildToolsVersion "23.0.0"
defaultConfig {
applicationId "com.parse.starter"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
javaMaxHeapSize "4g"
}
}
dependencies {
compile 'com.parse.bolts:bolts-android:1.2.1'
compile 'com.parse:parse-android:1.10.2'
compile 'com.koushikdutta.ion:ion:2.+'
compile 'com.android.support:appcompat-v7:23.0.0'
compile 'com.google.android.gms:play-services:7.8.0'
compile 'com.google.android.gms:play-services-fitness:7.8.0'
compile 'com.google.android.gms:play-services-wearable:7.8.0'
compile 'com.facebook.android:facebook-android-sdk:4.0.0'
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.3'
compile 'com.android.support:design:23.0.0'
compile 'com.soundcloud.android:android-crop:1.0.0@aar'
compile 'me.grantland:autofittextview:0.2.+'
compile 'com.github.boxme:squarecamera:1.0.3'
}
/* Uncomment if you enable ProGuard and you want to automatically upload symbols on build.
parse {
applicationId "YOUR_APPLICATION_ID"
masterKey "YOUR_MASTER_KEY"
// Make symbol upload automatic. Otherwise, use e.g. ../gradlew parseUploadSymbolsDebug;
uploadSymbols true
}
*/
如果我在我的OnePlus One,Android 5.1.1(Cyanogen OS 12.1-YOG4PAS1N0)上运行该应用程序,它就像一个魅力。 在我的LG BELLO,Android 4.4.2上,它没有运行,我有以下
StackTrace:
10-22 15:11:06.951 26337-26337/? I/dalvikvm: Could not find method android.view.Window$Callback.onWindowStartingActionMode, referenced from method android.support.v7.internal.view.WindowCallbackWrapper.onWindowStartingActionMode
10-22 15:11:06.951 26337-26337/? W/dalvikvm: VFY: unable to resolve interface method 17145: Landroid/view/Window$Callback;.onWindowStartingActionMode (Landroid/view/ActionMode$Callback;I)Landroid/view/ActionMode;
10-22 15:11:06.951 26337-26337/? D/dalvikvm: VFY: replacing opcode 0x72 at 0x0002
10-22 15:11:06.965 26337-26337/? D/AndroidRuntime: Shutting down VM
10-22 15:11:06.965 26337-26337/? W/dalvikvm: threadid=1: thread exiting with uncaught exception (group=0x41e09da0)
10-22 15:11:06.967 26337-26337/? E/AndroidRuntime: FATAL EXCEPTION: main
10-22 15:11:06.967 26337-26337/? E/AndroidRuntime: Process: com.parse.starter, PID: 26337
10-22 15:11:06.967 26337-26337/? E/AndroidRuntime: java.lang.NoClassDefFoundError: android.support.v7.appcompat.R$layout
10-22 15:11:06.967 26337-26337/? E/AndroidRuntime: at android.support.v7.app.AppCompatDelegateImplV7.ensureSubDecor(AppCompatDelegateImplV7.java:307)
10-22 15:11:06.967 26337-26337/? E/AndroidRuntime: at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:254)
10-22 15:11:06.967 26337-26337/? E/AndroidRuntime: at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:109)
10-22 15:11:06.967 26337-26337/? E/AndroidRuntime: at com.parse.starter.MainActivity.onCreate(MainActivity.java:24)
10-22 15:11:06.967 26337-26337/? E/AndroidRuntime: at android.app.Activity.performCreate(Activity.java:5275)
10-22 15:11:06.967 26337-26337/? E/AndroidRuntime: at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
10-22 15:11:06.967 26337-26337/? E/AndroidRuntime: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2169)
10-22 15:11:06.967 26337-26337/? E/AndroidRuntime: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2255)
10-22 15:11:06.967 26337-26337/? E/AndroidRuntime: at android.app.ActivityThread.access$800(ActivityThread.java:142)
10-22 15:11:06.967 26337-26337/? E/AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1203)
10-22 15:11:06.967 26337-26337/? E/AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:102)
10-22 15:11:06.967 26337-26337/? E/AndroidRuntime: at android.os.Looper.loop(Looper.java:136)
10-22 15:11:06.967 26337-26337/? E/AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:5118)
10-22 15:11:06.967 26337-26337/? E/AndroidRuntime: at java.lang.reflect.Method.invokeNative(Native Method)
10-22 15:11:06.967 26337-26337/? E/AndroidRuntime: at java.lang.reflect.Method.invoke(Method.java:515)
10-22 15:11:06.967 26337-26337/? E/AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
10-22 15:11:06.967 26337-26337/? E/AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:605)
10-22 15:11:06.967 26337-26337/? E/AndroidRuntime: at dalvik.system.NativeStart.main(Native Method)
10-22 15:12:45.993 26337-26337/com.parse.starter I/Process: Sending signal. PID: 26337 SIG: 9
我注意到了这些线条:
compile 'com.android.support:design:23.0.0'
compile 'com.parse:parse-android:1.10.2'
似乎是问题的根源。
有人能帮助我吗?
谢谢:)
这是直接下载我的项目的链接: http://we.tl/ZWy1c9ETx0
杰夫