Erro de Tela de Splash Android

3 respostas Resolvido
mobile
I

Alguém pode ajudar com esse erro, pois não consigo seguir em frente com o projeto. Estou criando uma tela de SPLASH porem fiz igual a do livro, mas quando compilo aparece esse erro?

07-19 13:23:33.862 21022-21022/com.example.ivanalves.mark_eshopping E/AndroidRuntime: FATAL EXCEPTION: main                                                                                 Process:com.example.ivanalves.mark_eshopping, PID: 21022 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.ivanalves.mark_eshopping/com.example.ivanalves.mark_eshopping.Splashctivity}: android.view.InflateException: Binary XML file line #14: Error inflating class android.support.v4.widget.CircleImageView

at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2205)

at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2255)

at android.app.ActivityThread.access$800(ActivityThread.java:142)

at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1203)

at android.os.Handler.dispatchMessage(Handler.java:102)

at android.os.Looper.loop(Looper.java:136)

at android.app.ActivityThread.main(ActivityThread.java:5118)

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:789)

at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:605)

at dalvik.system.NativeStart.main(Native Method)

Caused by: android.view.InflateException: Binary XML file line #14: Error inflating class android.support.v4.widget.CircleImageView

at android.view.LayoutInflater.createView(LayoutInflater.java:603)

at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696)

at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)

at android.view.LayoutInflater.inflate(LayoutInflater.java:492)

at android.view.LayoutInflater.inflate(LayoutInflater.java:397)

at android.view.LayoutInflater.inflate(LayoutInflater.java:353)

at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:280)

at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)

at com.example.ivanalves.mark_eshopping.Splashctivity.onCreate(Splashctivity.java:20)

at android.app.Activity.performCreate(Activity.java:5275)

at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)

at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2169)

at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2255)

at android.app.ActivityThread.access$800(ActivityThread.java:142)

at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1203)

at android.os.Handler.dispatchMessage(Handler.java:102)

at android.os.Looper.loop(Looper.java:136)

at android.app.ActivityThread.main(ActivityThread.java:5118)

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:789)

at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:605)

at dalvik.system.NativeStart.main(Native Method)

Caused by: java.lang.NoSuchMethodException:  [class android.content.Context, interface android.util.AttributeSet]

at java.lang.Class.getConstructorOrMethod(Class.java:472)

at java.lang.Class.getConstructor(Class.java:446)

at android.view.LayoutInflater.createView(LayoutInflater.java:568)

at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696)

at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)

at android.view.LayoutInflater.inflate(LayoutInflater.java:492)

at android.view.LayoutInflater.inflate(LayoutInflater.java:397)

at android.view.LayoutInflater.inflate(LayoutInflater.java:353)

at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:280)

at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)

at com.example.ivanalves.mark_eshopping.Splashctivity.onCreate(Splashctivity.java:20)

at android.app.Activity.performCreate(Activity.java:5275)

at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)

at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2169)

at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2255)

at android.app.ActivityThread.access$800(ActivityThread.java:142)

at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1203)

at android.os.Handler.dispatchMessage(Handler.java:102)

at android.os.Looper.loop(Looper.java:136)

at android.app.ActivityThread.main(ActivityThread.java:5118)

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:789)

at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:605)

at dalvik.system.NativeStart.main(Native Method)

3 Respostas

Leonardo_Dias

O problema é o CircleImageView.

Você está usando alguma lib? Como você está fazendo pra declarar?

I

SplashActivity

public class Splashctivity extends MainActivity implements Runnable{

private final int DALAY =3000;


@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_splashctivity);

    Toast.makeText(this,"AGUARDE O CARREGAMENTO DA APLICAÇÃO...", Toast.LENGTH_LONG).show();

    Handler h = new Handler();
    h.postDelayed(this, DALAY);

    }

   public void run(){

       startActivity( new Intent(Splashctivity.this, MainActivity.class));
       finish();

   }

}

AndroidManifest.XML

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.ivanalves.mark_eshopping">

<!--
     The ACCESS_COARSE/FINE_LOCATION permissions are not required to use
     Google Maps Android API v2, but you must specify either coarse or fine
     location permissions for the 'MyLocation' functionality. 
-->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

<application
    android:name="android.support.multidex.MultiDexApplication"
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:supportsRtl="true"
    android:theme="@style/AppTheme">

    <activity
        android:name=".Splashctivity"
        android:label="@string/app_name"
        android:theme="@style/AppTheme.NoActionBar">

        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />

        </intent-filter>

    </activity>


    <activity
        android:name=".MainActivity"
        android:label="@string/app_name"
        android:theme="@style/AppTheme.NoActionBar">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>


    <activity android:name=".CATEGORIAS" />
    <activity android:name=".OFERTAS" />
    <activity android:name=".DICAS" />
    <activity android:name=".NOTIFICACAO" />
    <activity android:name=".CONFIGURACAO" />
    <activity android:name=".SOBRE" />

    <!--
         The API key for Google Maps-based APIs is defined as a string resource.
         (See the file "res/values/google_maps_api.xml").
         Note that the API key is linked to the encryption key used to sign the APK.
         You need a different API key for each encryption key, including the release key that is used to
         sign the APK for publishing.
         You can define the keys for the debug and release targets in src/debug/ and src/release/. 
    -->
    <meta-data
        android:name="com.google.android.geo.API_KEY"
        android:value="@string/google_maps_key" />

    <activity
        android:name=".MAPA"
        android:label="@string/title_activity_map" />
</application>

Activity_SplashActivity

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#fbe6e6"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context="com.example.ivanalves.mark_eshopping.Splashctivity"
    android:weightSum="1">

    <android.support.v4.widget.CircleImageView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:src="@drawable/splash" />

</LinearLayout>
Leonardo_Dias
Solucao aceita

Tenta usar uma Lib ao invés desse CircleImageView que você está usando, exemplo:

Coloque no seu build.gradle junto as outras depêndencias:

dependencies {
    compile 'de.hdodenhof:circleimageview:2.1.0'
}

E declare ele dessa forma:

<de.hdodenhof.circleimageview.CircleImageView
    android:layout_width="96dp"
    android:layout_height="96dp"
    android:src="@drawable/splash"
    app:civ_border_width="2dp"
    app:civ_border_color="#FF000000"/>

Abraços.

Criado 19 de julho de 2016
Ultima resposta 19 de jul. de 2016
Respostas 3
Participantes 2