in android

A few points to start working on Android Studio

Import Github project error

When download and import Github project into Android Studio, encountered error "Plugin with id 'com.android.application' not found", there should be two build.gradle file in the project, the project build.gradle file and module build.gradle file. Somehow after importing into the Android Studio, the content of project build.gradle file becomes the same as module build.gradle file, after building, it returns error `”Plugin with id ‘com.android.application’ not found”.

Solution:
Refer to
Android Studio导入工程报错[Plugin with id ‘com.android.application’ not found]
解决错误:Plugin with id ‘com.android.application’ not found
Android Gradle plugin release notes

Solution 1:
Copy the correct plug-in content into project build.gradle file, below is an example:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {

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

        classpath 'io.realm:realm-gradle-plugin:5.3.0'

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

Solution 2:
Go to File > Project Structure > Project menu in Android Studio to set the correct Android plug-in version.

Configure on-device developer options

Refer to below links:
Configure on-device developer options
Configure Android Studio
Run apps on a hardware device
3.1: The Android Studio Debugger

can’t have non-Gradle Java modules and Android-Gradle modules in one project

Solution:
Refer to
Error: Unfortunately you can’t have non-Gradle Java modules and > Android-Gradle modules in one project

1- close the project

2- close Android Studio IDE

3- delete the .idea directory

4- delete all .iml files

5- open Android Studio IDE and import the project

Setting the ConstraintLayout

Refer to How to center the elements in ConstraintLayout

app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"

Reference

Android Studio导入工程报错[Plugin with id ‘com.android.application’ not found]
解决错误:Plugin with id ‘com.android.application’ not found
Android Gradle plugin release notes
Configure on-device developer options
Configure Android Studio
Run apps on a hardware device
3.1: The Android Studio Debugger
Error: Unfortunately you can’t have non-Gradle Java modules and > Android-Gradle modules in one project
How to center the elements in ConstraintLayout

Write a Comment

Comment