Joy Dey
Joy Dey

Reputation: 593

How to fix cannot find symbol method bitmap()?

I'm trying to generate QR code in my app with com.github.kenglxn.QRGen:javase:2.4.0' library.

This is my code:

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        Bitmap myBitmap = QRCode.from("www.facebook.com").bitmap();
        ImageView myImage = (ImageView) findViewById(R.id.imageView);
        myImage.setImageBitmap(myBitmap);
    }

}

I get an error saying:

Error:(23, 58) error: cannot find symbol method bitmap()

How can i fix this issue?

Upvotes: 0

Views: 978

Answers (1)

Pavneet_Singh
Pavneet_Singh

Reputation: 37404

From Docs, Bitmap() is only available in the android version so you have to use below dependency

 compile 'com.github.kenglxn.QRGen:android:2.4.0'

instead of java oriented dependency

com.github.kenglxn.QRGen:javase:2.4.0'

Upvotes: 2

Related Questions