简体   繁体   中英

Android : unresolved packages and class

in my AndroidManifest.xml, my receiver, service and activities are not found,

it should find en.company.android.name.myclass

however it says my packages(en, company, android, name) are unresolved, and so is the class inside of it.

here is the structure that it should find :

在此输入图像描述

exemple in my AndroidManifest :

<receiver android:name="en.company.android.name.SimpleWakefulReceiver" android:permission="com.google.android.c2dm.permission.SEND">

转到项目文件位置,删除构建文件夹,重新打开项目,它对我有用;

step1. File--> close the project from android studio. step2. Go to project folder delete .idea folder. step3. Open android studio and open project from gradle.

The project will be rebuilt and it will be resolved

This looks like your functional directory is not correct and you can not find the build directory. You can do this:

  1. If it is eclipse you can rebuild a new android project your java lowest level package copied to the new package

  2. If android studio is simple, the path to src in gradle points to the underlying package, like this

    android {
    compileSdkVersion 19
    buildToolsVersion '25.0.0'
    ......
    sourceSets {
    main { manifest.srcFile 'AndroidManifest.xml'
    java.srcDirs = ['src/java']
    ......
    }
    ......
    }
    }

For me I had recently changed a typo in my package name/file folder and after that my activities could not be found. Thought I'd fixed it everywhere but I'd missed fixing it in my .idea/workspace.xml ... once I fixed it there I restarted android studio did a clean and build and then I was up and running again.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM