android.support.v7.widget.CardView (исправить путь сборки, изменить XML, создать класс) с помощью Android Studio 3.4 - PullRequest
0 голосов
/ 20 апреля 2019

Я создавал приложение, и оно работало хорошо, пока я не обновился до последней версии Android Studio. Я получаю ошибку "Android.support.v7.widget.CardView (исправить путь сборки, изменить XML, создать класс)" Мой карт не показывает изображение. Приложение хорошо компилируется и устанавливается на мой телефон, но вылетает при запуске. И вчера все работало нормально. У меня последние зависимости, и я не знаю, почему не работает мой картридер. Любое решение? Нужно ли понижать версию sdkversion? Я искал повсюду и следил за многими исправлениями, и теперь я буквально стаскиваю свои волосы, пытаясь исправить эту ошибку. Изменение текущих зависимостей для соответствия buildToolsVersion, похоже, тоже не работает.

Изображение моей ошибки

XML

<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".Suicune">

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/bg"
    android:orientation="vertical"
    android:weightSum="12">


    <GridLayout
        android:id="@+id/mainGrid"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="6"
        android:alignmentMode="alignMargins"
        android:columnCount="1"
        android:columnOrderPreserved="false"
        android:padding="14dp"
        android:rowCount="3">

        <!-- Row 1 -->

        <!-- Column 1 -->
        <android.support.v7.widget.CardView
            android:layout_width="1dp"
            android:layout_height="1dp"
            android:layout_rowWeight="1"
            android:layout_columnWeight="1"
            android:layout_marginLeft="90dp"
            android:layout_marginRight="90dp"
            android:layout_marginBottom="16dp"
            app:cardCornerRadius="5dp"
            app:cardElevation="8dp">

            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center_horizontal|center_vertical"
                android:layout_margin="0dp"
                android:orientation="vertical">

                <ImageView
                    android:id="@+id/suicuneframedata_button"
                    android:layout_width="wrap_content"
                    android:scaleType="fitXY"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center_horizontal"
                    android:src="@drawable/framedata_button" />


            </LinearLayout>

        </android.support.v7.widget.CardView>

        <!-- Column 2 -->
        <android.support.v7.widget.CardView

            android:layout_width="1dp"
            android:layout_height="1dp"
            android:layout_rowWeight="1"
            android:layout_columnWeight="1"
            android:layout_marginLeft="90dp"
            android:layout_marginRight="90dp"
            android:layout_marginBottom="16dp"
            app:cardCornerRadius="5dp"
            app:cardElevation="8dp">

            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center_horizontal|center_vertical"
                android:layout_margin="0dp"
                android:orientation="vertical">

                <ImageView
                    android:id="@+id/suicunecombosheets_button"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:scaleType="fitXY"
                    android:layout_gravity="center_horizontal"
                    android:src="@drawable/combosheets_button" />


            </LinearLayout>

        </android.support.v7.widget.CardView>


        <android.support.v7.widget.CardView
            android:layout_width="1dp"
            android:layout_height="1dp"
            android:layout_rowWeight="1"
            android:layout_columnWeight="1"
            android:layout_marginLeft="90dp"
            android:layout_marginRight="90dp"
            android:layout_marginBottom="16dp"
            app:cardCornerRadius="5dp"
            app:cardElevation="8dp">

            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center_horizontal|center_vertical"
                android:layout_margin="0dp"
                android:orientation="vertical">

                <ImageView
                    android:id="@+id/suicunenotableplayers_button"
                    android:layout_width="wrap_content"
                    android:scaleType="fitXY"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center_horizontal"
                    android:src="@drawable/notableplayers_button" />


            </LinearLayout>

        </android.support.v7.widget.CardView>

    </GridLayout>

</LinearLayout>

Java класс

package com.example.sayafkadam.ptdxassault;

 import android.content.Intent;
 import android.os.Bundle;
 import android.view.View;
 import android.widget.ImageView;

 import androidx.appcompat.app.AppCompatActivity;

 public class Suicune extends AppCompatActivity {

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

    getSupportActionBar().setTitle("Suicune Database");
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    ImageView FrameData;
    ImageView ComboSheets;
    ImageView NotablePlayers;


    FrameData = (ImageView) findViewById(R.id.suicuneframedata_button);
    FrameData.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent intentLoadSuicuneInfo = new Intent(Suicune.this,           
    SuicuneFD.class);
            startActivity(intentLoadSuicuneInfo);
        }
    });


    NotablePlayers = (ImageView) findViewById(R.id.suicunenotableplayers_button);
    NotablePlayers.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent intentLoadNotablePlayers = new Intent(Suicune.this, 
 SuicuneNP.class);
            startActivity(intentLoadNotablePlayers);
        }
    });
 }
 }

Мой Gradle

apply plugin: 'com.android.application'

 android {
compileSdkVersion 28
defaultConfig {
    applicationId "com.example.sayafkadam.ptdxassault"
    minSdkVersion 15
    targetSdkVersion 28
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner 
 "android.support.test.runner.AndroidJUnitRunner"
 }
 buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 
 'proguard-rules.pro'
    }
 }
 buildToolsVersion = '28.0.3'
 }

  dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.android.support:gridlayout-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.github.chrisbanes:PhotoView:2.2.0'
implementation 'com.github.barteksc:android-pdf-viewer:3.1.0-beta.1'
implementation 'gr.pantrif:easy-android-splash-screen:0.0.1'
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'

 }

1 Ответ

0 голосов
/ 20 апреля 2019

Можете ли вы попробовать использовать

 implementation 'androidx.cardview:cardview:1.0.0'

Вместо и

androidx.cardview.widget.CardView

В XML?

...