Tek Eye Logo

Tek Eye

Setup Android Development Environment - Windows

Want to write apps for your Android mobile phone, tablet or other device? Own a decent spec Windows computer? Then use Google's free software to setup an Android development environment in Windows. This article is an introduction to configuring Windows for Android development. Don't own a Windows PC? No problem Android Studio also runs on Apple and Linux computers.

Setup Android Development on Windows

For those who don't need any background information and want to get going developing apps then see Android Studio Install for Windows Based PCs.

Google Integrated Development Environment for App Writing

To develop applications (apps) use an Integrated Development Environment (IDE). An IDE is an all-in-one program for writing, running and debugging software, such as Android apps. What can you do in an IDE? You can:

  • Design the app's screens.
  • Write the app code.
  • Perform test runs of the app on a physical device or emulator.
  • Debug the app.
  • Package the app for the Google Play store and other app stores (Amazon, Samsung, etc.).

There are many IDEs available, for Android development Google recommends its own Android Studio, which is based upon the Intellij IDEA product from JetBrains. A version of Studio is available for GNU/Linux PCs and Apple Macs.

Android Studio

The Java programming language is used extensively to develop apps. The Android Application Programming Interface (API) was primarily designed to be used with Java, however, Google is now pushing the Kotlin languuge for app development (Kotlin is fully compatible with Java).

Install Android Studio and Get a Working IDE for App Writing

Setting up Android Studio can take some time with a slow Internet connection. It is also recommended that a recent Intel i5, i7, Ryzen or Xeon based PC is used for best performance. There are several steps that need to be completed for a fully working Android Studio environment for building Android apps:

  1. Download and install Android Studio for Windows.
  2. Run the Android SDK Manager to update the Android SDK and install extra packages.
  3. Optionally install the Intel HAXM utility for better Andoid Virtual Device (AVD) performance (if the Studio installer failed to install HAXM).
  4. Configure an AVD for testing your code.
  5. Install device drivers for testing code on physical devices.

The normal method for installing Android Studio is to use the Android Studio Windows installer. To install Android Studio using this method see our article Android Studio Install for Windows Based PCs.

Alternatively Google provides zip files containing Studio and the Android SDK, see the other download options for Studio. This allows for a custom set up.

The Android SDK comes with a rich API for developing apps for a wide range of applications. Enjoy your Android programming.

Android Studio IDE

Archived Comments

Mehmet asked on 4th May 2020 at 14:30 - Hi, I would make a convert to coloring image app in Android. User will select a photo in the gallery and the photo will converted to a coloring image, or like this - I uploaded the image. I don't know how to do this. How can I make this app? Can you help me? Thank you.

Tek Eye replied on 4th May 2020 at 18:07 - Hi Mehmet, the process is called edge detection.

Edge detection has been around for a long time. There are algorithms and Java libraries and code available via an Internet search. Canny edge detection is a popular algorithm. You may need to invert the image as edges are often white on black. The inverted image will be black on white.

The app will need:

  1. Upload or select an image.
  2. Pass the image through an edge detection filter algorithm.
  3. Invert the image if required.
  4. Save the new image
  5. Allow painting on the new image (lots of opensource drawing applications are available for Android for painting code).

Hope that can get you started

Mehmet replied on 5th May 2020 at 11:02 - Hi, thanks a lot. Good day.

Mehmet asked on 13th May 2020 at 13:40 - Hi, I searched and found code. But I get this error:

E/org.opencv.imgproc(19601): imgproc::Canny_13() caught cv::Exception:
    OpenCV(3.4.3) /build/3_4_pack-android/opencv/modules/imgproc/src/canny.cpp:964: error:
        (-206:Bad flag (parameter or structure field)) Aperture size should be odd between 3 and 7
            in function 'void cv::Canny(cv::InputArray, cv::OutputArray, double, double, int, bool)'
W/System.err(19601): CvException [org.opencv.core.CvException: cv::Exception:
    OpenCV(3.4.3) /build/3_4_pack-android/opencv/modules/imgproc/src/canny.cpp:964: error:
        (-206:Bad flag (parameter or structure field)) Aperture size should be odd between 3 and 7
            in function 'void cv::Canny(cv::InputArray, cv::OutputArray, double, double, int, bool)'

The code:

private void detectEdges(Bitmap bitmap) {
    Mat rgba = new Mat();
    Utils.bitmapToMat(bitmap, rgba);
    Mat edges = new Mat(rgba.size(), CvType.CV_8UC1);
    Imgproc.cvtColor(rgba, edges, Imgproc.COLOR_RGB2GRAY, 4);
    Imgproc.Canny(edges, edges, 80, 100);
    // Don't do that at home or work it's for visualization purpose.
    BitmapHelper.showBitmap(this, bitmap, imageView);
    Bitmap resultBitmap = Bitmap.createBitmap(edges.cols(), edges.rows(), Bitmap.Config.ARGB_8888);
    Utils.matToBitmap(edges, resultBitmap);
    BitmapHelper.showBitmap(this, resultBitmap, detectEdgesImageView);
}    

How I can resolve this problem? I need help.

Tek Eye replied on 13th May 2020 at 10:20 - Hi Mehmet, the error message gives an indication of where to look:

...imgproc::Canny_13()...Aperture size should be odd between 3 and 7...

So something is wrong with the line Imgproc.Canny(edges, edges, 80, 100);

Looking at the documentation (https://docs.opencv.org/2.4/doc/tutorials/imgproc/imgtrans/canny_detector/canny_detector.html) it looks like it may need another argument, e.g.:

Imgproc.Canny(edges, edges, 80, 100,3);

However, it is not my area of expertise.

If you have programming questions a good place is Stack Overflow, for example, there is a question on OpenCV crashing on Canny: https://stackoverflow.com/questions/47638929/opencv-canny-edge-detection-crashes-on-android-app

If you do get stuck and can explain your problem clearly and provide the error message and code then asking a question on Stack Overflow can work. All the OpenCV Canny questions can be seen here: https://stackoverflow.com/search?page=2&tab=Relevance&q=OpenCV%20canny

See Also

Author:  Published:  Updated:  

ShareSubmit to TwitterSubmit to FacebookSubmit to LinkedInSubmit to redditPrint Page

markdown CMS Small Logo Icon ↓markdown↓ CMS is fast and simple. Build websites quickly and publish easily. For beginner to expert.


Articles on:

Android Programming and Android Practice Projects, HTML, VPS, Computing, IT, Computer History, ↓markdown↓ CMS, C# Programming, Using Windows for Programming


Free Android Projects and Samples:

Android Examples, Android List Examples, Android UI Examples



Maintain your PC with Piriform

Shop at Tek Eye for PC utilities