为什么我有r错误甚至包括afollestad文件夹?

时间:2018-03-17 11:36:58

标签: java android

为什么会说

  

错误:(213,32)错误:包R不存在

  

错误:(29,47)错误:包me.zhanghai.android.materialprogressbar不存在

我已经更改了manifest包,androidmanifest.xml:

 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.enduser.mybmicalculator.MainActivity">

<uses-permission android:name="android.permission."/>

<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:roundIcon="@mipmap/ic_launcher_round"
    android:supportsRtl="true"
    android:theme="@style/AppTheme">
    <activity android:name="com.example.enduser.mybmicalculator.MainActivity">

这是错误源,MDButton.java

import com.afollestad.materialdialogs.R;

这是manifest.java

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

    package="com.example.enduser.mybmicalculator">



<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:roundIcon="@mipmap/ic_launcher_round"
    android:supportsRtl="true"
    android:theme="@style/AppTheme">
    <activity 
android:name="com.example.enduser.mybmicalculator.MainActivity">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

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

 <uses-permission android:name="android.permission."/>

 </manifest>

的build.gradle(项目:MyBMICalculator)

buildscript {

repositories {
    google()
    jcenter()
}
dependencies {
    classpath 'com.android.tools.build:gradle:3.0.1'



    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}
}

allprojects {
repositories {
    google()
    jcenter()
    maven {
        url "https://maven.google.com"
    }
}
}

task clean(type: Delete) {
delete rootProject.buildDir
}

这个是build.gradle(module:app)

 apply plugin: 'com.android.application'

android {
compileSdkVersion 26
defaultConfig {
    applicationId "com.example.enduser.mybmicalculator"
    minSdkVersion 21
    targetSdkVersion 26
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner 
 "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}

dependencies {
compile 'com.android.support:recyclerview-v7:26.1.0'
compile 'com.android.support:support-core-utils:26.1.0'
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-
core:3.0.1'

}

1 个答案:

答案 0 :(得分:0)

您的包裹名称应如下所示: -

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.enduser.mybmicalculator">

Gradle文件也添加以下代码: -

implementation 'me.zhanghai.android.materialprogressbar:library:1.4.2'