Search code examples
androidandroid-studiozxing

ZXing imports disappearing


I am trying to install zxing in android studio but i am running into some trouble. I have looked around at lots of different posts and tutorials and they have all said to just add the following lines into the build.gradle dependencies

compile 'com.google.zxing:core:3.1.0'
compile 'com.google.zxing:android-integration:3.1.0'

I have done this and synced everything but when I try and add an import like

import com.google.zxing.integration.android.IntentResult;

at the top of my project it instantly disappears without an errors or warning.

Has anyone else had this problem or know what I am doing wrong?


Solution

  • Your IDE will remove the import if you have some auto-cleaning unused import statements. It depends on the IDE to configure this option but both Android Studio and Eclipse have this feature.

    I suggest you to start using this IntentResult and then it will keep the import statement.