Java 实现 'com.android.support:appcompat-v7:28.0.0-beta01' 显示错误

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/51761100/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-11 00:14:26  来源:igfitidea点击:

implementation 'com.android.support:appcompat-v7:28.0.0-beta01' showing error

javaandroidxml

提问by

please help me. i was created an android project completely. but problems is my app gradle file showing this error sshot below.

请帮我。我完全创建了一个android项目。但问题是我的应用程序 gradle 文件在下面显示了这个错误。

Error

错误

and i have one more problem. i was set InterstitialAd but it's not showing in my activity. please inform me how to solve this problem??

我还有一个问题。我设置了 InterstitialAd 但它没有显示在我的活动中。请告诉我如何解决这个问题??

gradle.build

gradle.build

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support:appcompat-v7:28.0.0-beta01'
    implementation 'com.android.support.constraint:constraint-layout:1.1.2'
    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.android.support:design:28.0.0-beta01'
    implementation 'com.android.support:cardview-v7:28.0.0-beta01'
    implementation 'com.google.android.gms:play-services-ads:15.0.1'
}

activity java

活动Java

AdRequest adRequest = new AdRequest.Builder().build();
        interstitial = new InterstitialAd(Howtogeek.this);
        interstitial.setAdUnitId(getString(R.string.admob_interstitial_id));

        interstitial.loadAd(adRequest);
        interstitial.setAdListener(new AdListener() {
            public void onAdLoaded() {
                displayInterstitial();
            }
        });

        Howtogeek = (WebView)findViewById(R.id.Howtogeek);
        bar = (ProgressBar)findViewById(R.id.bar);
        Howtogeek.setWebViewClient(new Howtogeek.myWebclient());
        bar.setMax(100);
        Howtogeek.loadUrl("https://www.howtogeek.com/");

        WebSettings webSettings = Howtogeek.getSettings();
        webSettings.setJavaScriptEnabled(true);
        Howtogeek.getSettings().setRenderPriority(WebSettings.RenderPriority.HIGH);
        Howtogeek.getSettings().setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);
        Howtogeek.getSettings().setAppCacheEnabled(true);
        Howtogeek.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
        webSettings.setDomStorageEnabled(true);
        webSettings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.NARROW_COLUMNS);
        webSettings.setUseWideViewPort(true);
        webSettings.setSavePassword(true);
        webSettings.setSaveFormData(true);
        webSettings.setEnableSmoothTransition(true);
    }

    public void displayInterstitial() {
        if (interstitial.isLoaded()) {
            interstitial.show();
        }
    }

回答by user10003069

Try to clean project and rebuild.

尝试清理项目并重建。

回答by Vi?t Anh ?ào

I have the same problem as you. you have to add all the libraries which are shown in "examples include" not same version

我和你有同样的问题。您必须添加“示例包括”中显示的所有库,而 不是相同版本

回答by Sirwan Rahimi

i had it too. problem was with

我也有。问题出在

implementation 'com.android.support:cardview-v7:28.0.0-rc01'

i changed it to

我把它改成

 implementation 'com.android.support:cardview-v7:27.0.1'

and it works well

它运作良好

回答by Sirwan Rahimi

Try this Google Play implemented target version of API 26 so use API 27 still good

试试这个 Google Play 实现的 API 26 目标版本,所以使用 API 27 还是不错的

implementation 'com.android.support:appcompat-v7:27.0.1'
implementation 'com.android.support:design:27.0.1'

And also use the later version of play services

并且还使用了更高版本的播放服务

implementation 'com.google.android.gms:play-services-ads:12.0.0'

回答by Vijendra patidar

If you have use this

如果你有使用这个

 implementation 'com.android.support:appcompat-v7:28.0.2'

and also use one more dependency

并使用另一种依赖

 implementation 'com.android.support:support-v13:28.0.2'

this is work for me. I hope it will help you.

这对我来说是工作。我希望它会帮助你。

回答by H.Janjani

I have had the same problem.... as you know Android 9.0 (API level 28) there is a new version of the support library called AndroidX. You can continue to use the support library (those versioned 27 and earlier) BUTgoogle Developer recommend using the AndroidX libraries in all new projects.

我遇到了同样的问题.... 如您所知,Android 9.0(API 级别 28)有一个名为 AndroidX 的支持库的新版本。您可以继续使用支持库(版本为 27 及更早版本),谷歌开发人员建议在所有新项目中使用 AndroidX 库。

With Android Studio 3.2 and higher, you can quickly migrate an existing project to use AndroidX by selecting Refactor > Migrate to AndroidX from the menu bar.

使用 Android Studio 3.2 及更高版本,您可以通过从菜单栏中选择 Refactor > Migrate to AndroidX 快速迁移现有项目以使用 AndroidX。

Further reading:

进一步阅读:

https://developer.android.com/topic/libraries/support-library/https://developer.android.com/jetpack/androidx/migrate

https://developer.android.com/topic/libraries/support-library/ https://developer.android.com/jetpack/androidx/migrate

It worked for me. good luck

它对我有用。祝你好运

回答by Bukunmi

I used

我用了

allprojects {
repositories {
    mavenCentral()
    google()
    jcenter()

}

and

implementation 'com.facebook.android:facebook-android-sdk:[5,6)'