我正在尝试在GenyMotion中运行我的应用程序,但是我收到以下错误:
致命的例外:主要 java.lang.RuntimeException:无法启动活动ComponentInfo {com.voopter / com.myapp.splash.Splash}: android.view.InflateException:二进制XML文件行#14:错误 inflating类com.myapp.widgets.DosisRegularTextView 在android.app.ActivityThread.performLaunchActivity
我的XML:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<ImageView
android:id="@+id/imageView1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:background="@drawable/bg_splash" />
<com.myapp.widgets.DosisRegularTextView
android:id="@+id/dosisBoldTextView1"
android:textSize="20sp"
android:textColor="#5C5C5C"
android:visibility="gone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/imageView1"
android:layout_centerHorizontal="true"
android:layout_marginTop="20dp"
android:text="@string/splash" />
<com.myapp.widgets.DosisRegularTextView
android:id="@+id/DosisRegularTextView01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="15dp"
android:text="@string/splash_versao"
android:textColor="#5C5C5C"
android:textSize="14sp" />
</RelativeLayout>
如果我只是在我的xml中注释掉DosisRegularTextView
,则错误会转移到其他位置。如果我发表评论,它会转移到另一个,依此类推......它永远不会结束。可以在class,xml,Handler等中。
My DosisRegularTextView:
public class DosisRegularTextView extends TextView {
public DosisRegularTextView(Context context) {
super(context);
if (!isInEditMode())
setFont();
}
public DosisRegularTextView(Context context, AttributeSet attrs) {
super(context, attrs);
if (!isInEditMode())
setFont();
}
public DosisRegularTextView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
if (!isInEditMode())
setFont();
}
private void setFont() {
if (!isInEditMode())
setTypeface(Applic.typefaceDosisRegular);
}
}
我的Android Manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.myapp"
android:versionCode="2"
android:versionName="2.0" >
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="19" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_INTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permissions.READ_DATABASE" />
<uses-permission android:name="android.permissioms.WRITE_DATABASE" />
<uses-permission android:name="android.permission.STORAGE" />
<uses-permission android:name="android.permission.MANAGE_DOCUMENTS" />
<uses-permission android:name="android.permission.USE_CREDENTIALS" />
<uses-permission android:name="android.permission.SET_DEBUG_APP" />
<!-- PARSE -->
<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="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-feature
android:name="android.hardware.camera"
android:required="false" />
<uses-feature
android:name="android.hardware.location"
android:required="false" />
<uses-feature
android:name="android.hardware.location.gps"
android:required="false" />
<permission
android:name="com.myapp.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="com.myapp.permission.C2D_MESSAGE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" /> <!-- PARSE -->
<application
android:name=".Applic"
android:allowBackup="true"
android:icon="@drawable/ico_app"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<!-- <meta-data android:name="com.google.android.gms.version" android:value="7571000" /> -->
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="11111" />
<meta-data
android:name="com.facebook.sdk.ApplicationId"
android:value="@string/app_id" />
<!--<meta-data-->
<!--android:name="com.facebook.sdk.ApplicationId"-->
<!--android:value="@string/app_id" />-->
<!--<meta-data-->
<!--android:name="com.google.android.maps.v2.API_KEY"-->
<!--android:value="xxxx" />-->
<activity android:name="com.facebook.FacebookActivity"
android:configChanges=
"keyboard|keyboardHidden|screenLayout|screenSize|orientation"
android:theme="@android:style/Theme.Translucent.NoTitleBar"
android:label="@string/app_name" />
<meta-data
android:name="com.facebook.sdk.ApplicationName"
android:value="@string/facebook_app_name" />
<!-- Chave facebook homologacao - -->
<!--<provider-->
<!--android:name="com.facebook.FacebookContentProvider"-->
<!--android:authorities="com.facebook.app.FacebookContentProvider1111111111"-->
<!--android:exported="true" />-->
<!-- Chave facebook producao - -->
<provider
android:name="com.facebook.FacebookContentProvider"
android:authorities="com.facebook.app.FacebookContentProvider11111111"
android:exported="true" />
<receiver android:name=".login.enter.social.MyFacebookBroadcastReceiver" >
<intent-filter>
<action android:name="com.facebook.platform.AppCallResultBroadcast" />
</intent-filter>
</receiver>
<activity
android:name=".Home"
android:label="@string/app_name"
android:screenOrientation="portrait" >
</activity>
<activity
android:name=".buscar.calendar.CalendarHost"
android:label="@string/app_name"
android:screenOrientation="portrait" >
</activity>
<activity
android:name=".splash.Splash"
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=".login.Login"
android:label="@string/app_name"
android:screenOrientation="portrait" >
</activity>
<!-- PARSE -->
<service android:name="com.parse.PushService" />
<receiver
android:name="com.parse.ParsePushBroadcastReceiver"
android:exported="false" >
<intent-filter>
<action android:name="com.parse.push.intent.RECEIVE" />
<action android:name="com.parse.push.intent.DELETE" />
<action android:name="com.parse.push.intent.OPEN" />
</intent-filter>
</receiver>
<receiver
android:name="com.parse.GcmBroadcastReceiver"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<!-- IMPORTANT: Change "com.parse.starter" to match your app's package name. -->
<category android:name="com.myapp" />
</intent-filter>
</receiver>
</application>
</manifest>
最奇怪的是它在Android Studio Emulator和ARC Welder中运行良好。它只会在GenyMotion上崩溃(即使使用apk安装)。
尝试更新Google Play服务并登录,但无效。
这里发生了什么?