@Programist18946

Написал небольшое приложение, но на устройстве вылетает, почему?

Начал по урокам писать приложение на Java , но при запуске оно вылетает с ошибкой
I/MultiDex: VM with version 2.1.0 has multidex support
    Installing application
    VM has multidex support, MultiDex support library is disabled.
D/AndroidRuntime: Shutting down VM
E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.example.myapplication, PID: 6290
    java.lang.RuntimeException: Unable to get provider com.google.android.gms.ads.MobileAdsInitProvider: java.lang.IllegalStateException: 
    
    ******************************************************************************
    * The Google Mobile Ads SDK was initialized incorrectly. AdMob publishers    *
    * should follow the instructions here:                                       *
    * https://googlemobileadssdk.page.link/admob-android-update-manifest         *
    * to add a valid App ID inside the AndroidManifest.                          *
    * Google Ad Manager publishers should follow instructions here:              *
    * https://googlemobileadssdk.page.link/ad-manager-android-update-manifest.   *
    ******************************************************************************
    
    
        at android.app.ActivityThread.installProvider(ActivityThread.java:6242)
        at android.app.ActivityThread.installContentProviders(ActivityThread.java:5805)
        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5722)
        at android.app.ActivityThread.-wrap1(Unknown Source:0)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1656)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:164)
        at android.app.ActivityThread.main(ActivityThread.java:6494)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
     Caused by: java.lang.IllegalStateException: 
    
    ******************************************************************************
    * The Google Mobile Ads SDK was initialized incorrectly. AdMob publishers    *
    * should follow the instructions here:                                       *
    * https://googlemobileadssdk.page.link/admob-android-update-manifest         *
    * to add a valid App ID inside the AndroidManifest.                          *
    * Google Ad Manager publishers should follow instructions here:              *
    * https://googlemobileadssdk.page.link/ad-manager-android-update-manifest.   *
    ******************************************************************************
    
    
        at com.google.android.gms.internal.ads.zzbdz.attachInfo(com.google.android.gms:play-services-ads-lite@@20.2.0:20)
        at com.google.android.gms.ads.MobileAdsInitProvider.attachInfo(com.google.android.gms:play-services-ads-lite@@20.2.0:1)
        at android.app.ActivityThread.installProvider(ActivityThread.java:6239)
        	... 10 more


Вот MainActivity
package com.example.myapplication;

import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import android.graphics.CornerPathEffect;
import android.os.Bundle;

import com.example.myapplication.adapter.CategoryAdapter;
import com.example.myapplication.adapter.CourseAdapter;
import com.example.myapplication.model.Course;
import com.example.myapplication.model.category;

import java.util.ArrayList;
import java.util.List;
import java.util.Locale;

public class MainActivity extends AppCompatActivity {

    RecyclerView categoryRecycler , courseRecycler;
    CategoryAdapter categoryAdapter;
    CourseAdapter courseAdapter;

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

        List<category> categoryList = new ArrayList<>();
        categoryList.add(new category(1,"Игры"));
        categoryList.add(new category(2,"Сайты"));
        categoryList.add(new category(3,"Языки"));
        categoryList.add(new category(4,"Маркетинг"));
        categoryList.add(new category(5,"Дизайн"));
        categoryList.add(new category(6,"Прочее"));

        setCategoryRecycler(categoryList);


        List<Course> courseList = new ArrayList<>();
        courseList.add(new Course(1,"java" , "Профессия Java\nразработчик","1 января", "Начальный","#424345"));
        courseList.add(new Course(2,"python","Профессия Python\nразработчик","10 января","начальный", "#9FA52D"));

        setCourseRecycler(courseList);

        


    }


    private void setCategoryRecycler(List<category> categoryList) {

        RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(this,RecyclerView.VERTICAL,false );

        categoryRecycler = findViewById(R.id.categoryRecycler);
        categoryRecycler.setLayoutManager(layoutManager);

        categoryAdapter = new CategoryAdapter(this,categoryList);
        categoryRecycler.setAdapter(categoryAdapter);
    }

    private void setCourseRecycler(List<Course> courseList) {

        RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(this,RecyclerView.HORIZONTAL,false );

        courseRecycler = findViewById(R.id.categoryRecycler);
        courseRecycler.setLayoutManager(layoutManager);

        courseAdapter = new CourseAdapter(this,courseList);
        courseRecycler.setAdapter(categoryAdapter);
    }
}


Вот course.java
package com.example.myapplication.model;

public class Course {

    int id;
    String img,title,date,level,color;



    public Course(int id, String img, String title, String date, String level, String color) {
        this.id = id;
        this.img = img;
        this.title = title;
        this.date = date;
        this.level = level;
        this.color = color;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getImg() {
        return img;
    }

    public void setImg(String img) {
        this.img = img;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getDate() {
        return date;
    }

    public void setDate(String date) {
        this.date = date;
    }

    public String getLevel() {
        return level;
    }

    public void setLevel(String level) {
        this.level = level;
    }

    public String getColor() {
        return color;
    }

    public void setColor(String color) {
        this.color = color;
    }
}


P.S Делал по видео Дударя,не бейте пжлст
  • Вопрос задан
  • 227 просмотров
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы