亚洲视频二区_亚洲欧洲日本天天堂在线观看_日韩一区二区在线观看_中文字幕不卡一区

公告:魔扣目錄網(wǎng)為廣大站長提供免費(fèi)收錄網(wǎng)站服務(wù),提交前請做好本站友鏈:【 網(wǎng)站目錄:http://www.430618.com 】, 免友鏈快審服務(wù)(50元/站),

點(diǎn)擊這里在線咨詢客服
新站提交
  • 網(wǎng)站:51998
  • 待審:31
  • 小程序:12
  • 文章:1030137
  • 會(huì)員:747

本文介紹了無法解析符號'活動(dòng)公司'和內(nèi)容'的處理方法,對大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

問題描述

我是Android新手,正在學(xué)習(xí)如何實(shí)現(xiàn)基于位置的服務(wù),但我遇到了以下錯(cuò)誤-

無法解析符號‘ActivityCompat’
行‘導(dǎo)入android.support.v4.app.ActivityCompat;’

無法解析符號”Content”
在‘IMPORT android.support.v4.content.ContextCompat;’

‘行中

在做了一些研究之后,我發(fā)現(xiàn)您需要將以下內(nèi)容添加到gradle.build文件compile 'com.android.support:support-v4:23.0.0'

所以我這樣做了,但我仍然收到相同的錯(cuò)誤。我試過了,還是什么都沒有。

如何修復(fù)錯(cuò)誤?

這是我嘗試訪問的鏈接

https://www.tutorialspoint.com/android/android_location_based_services.htm#

這是我的Java文件-

package com.example.location;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.content.pm.PackageManager;

import android.Manifest;
import android.app.Activity;
import android.os.Bundle;
import android.support.v4.content.ContextCompat; # error
import android.support.v4.app.ActivityCompat;    #error
import android.view.View;
import android.widget.Button;
import android.widget.Toast;
import android.app.Activity;

// Remaining code

這是我的Gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 29
    buildToolsVersion "29.0.2"
    defaultConfig {
        applicationId "com.example.location"
        minSdkVersion 15
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.2.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
    implementation 'com.android.support:support-compat:+'
    implementation 'com.android.support:appcompat-v7:+'

    implementation 'com.android.support:support-v4:26.1.0'
}
'''

推薦答案

您必須使用androidx類:

添加依賴項(xiàng):

implementation "androidx.core:core-ktx:+"

并更改您的導(dǎo)入:

import android.support.v4.app.ActivityCompat -> import androidx.core.app.ActivityCompat
import android.support.v4.content.ContextCompat -> import androidx.core.content.ContextCompat

還要在build.gradle中刪除支持庫依賴項(xiàng):

//implementation 'com.android.support:support-compat:+'
//implementation 'com.android.support:appcompat-v7:+'
//implementation 'com.android.support:support-v4:26.1.0'

這篇關(guān)于無法解析符號'活動(dòng)公司'和內(nèi)容'的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,

分享到:
標(biāo)簽:amp 公司 內(nèi)容 活動(dòng) 符號 解析
用戶無頭像

網(wǎng)友整理

注冊時(shí)間:

網(wǎng)站:5 個(gè)   小程序:0 個(gè)  文章:12 篇

  • 51998

    網(wǎng)站

  • 12

    小程序

  • 1030137

    文章

  • 747

    會(huì)員

趕快注冊賬號,推廣您的網(wǎng)站吧!
最新入駐小程序

數(shù)獨(dú)大挑戰(zhàn)2018-06-03

數(shù)獨(dú)一種數(shù)學(xué)游戲,玩家需要根據(jù)9

答題星2018-06-03

您可以通過答題星輕松地創(chuàng)建試卷

全階人生考試2018-06-03

各種考試題,題庫,初中,高中,大學(xué)四六

運(yùn)動(dòng)步數(shù)有氧達(dá)人2018-06-03

記錄運(yùn)動(dòng)步數(shù),積累氧氣值。還可偷

每日養(yǎng)生app2018-06-03

每日養(yǎng)生,天天健康

體育訓(xùn)練成績評定2018-06-03

通用課目體育訓(xùn)練成績評定