A few points to start working on Android Studio

本文详细介绍了在Android Studio中导入Github项目时遇到“Pluginwithid'com.android.application'notfound”错误的原因及解决方案。提供了修改build.gradle文件和设置正确Android插件版本的方法,并附带了配置设备开发者选项和ConstraintLayout布局的参考资料。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值