./gradlew assemble
这将使用Gradle编译并打包您的应用程序。
示例代码:
//build.gradle文件中的示例
apply plugin: 'com.android.application'
android {
defaultConfig { applicationId "com.example.myapp" minSdkVersion 15 targetSdkVersion 29 versionCode 1 versionName "1.0" }
buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } } }
dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation 'androidx.appcompat:appcompat:1.3.0-alpha01' implementation 'com.google.android.material:material:1.2.1' implementation 'androidx.constraintlayout:constraintlayout:2.0.4' testImplementation 'junit:junit:4.12' androidTestImplementation 'androidx.test.ext:junit:1.1.2' androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' }
//运行assembleRelease任务
./gradlew assembleRelease
上一篇:win10 直通车-Win10 直通车:一键升级 Windows10 的神奇小工具,有它的爱与恨
下一篇:androidstudio-GradlesyncfailedError-occurredduringinitialization”