plugins { id 'com.android.application' id 'org.jetbrains.kotlin.android' } android { namespace 'com.example.app' compileSdk 34 defaultConfig { applicationId "com.example.app" minSdk 24 targetSdk 34 versionCode 2 versionName "1.1" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } signingConfigs { release { storeFile file(System.getenv('KEYSTORE_PATH') ?: '../keystore.jks') storePassword System.getenv('KEYSTORE_PASSWORD') ?: 'android123' keyAlias System.getenv('ALIAS') ?: 'logcam-release-key' keyPassword System.getenv('KEY_PASSWORD') ?: 'android123' } } buildTypes { debug { versionNameSuffix "-debug" } release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' // 只有在keystore文件存在时才配置签名 def keystoreFile = signingConfigs.release.storeFile if (keystoreFile.exists()) { signingConfig signingConfigs.release println "使用release签名配置" } else { println "警告: keystore文件不存在 (${keystoreFile.path}),release构建将使用默认签名" // 不设置signingConfig,让Gradle使用默认 } } } compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } kotlinOptions { jvmTarget = '1.8' } } dependencies { implementation 'androidx.core:core-ktx:1.12.0' implementation 'androidx.appcompat:appcompat:1.6.1' implementation 'com.google.android.material:material:1.11.0' implementation 'androidx.constraintlayout:constraintlayout:2.1.4' // CameraX core library def camerax_version = "1.3.0" implementation "androidx.camera:camera-core:${camerax_version}" implementation "androidx.camera:camera-camera2:${camerax_version}" implementation "androidx.camera:camera-lifecycle:${camerax_version}" implementation "androidx.camera:camera-video:${camerax_version}" // CameraX View class implementation "androidx.camera:camera-view:${camerax_version}" // CameraX Extensions (Effects) - Optional implementation "androidx.camera:camera-extensions:${camerax_version}" testImplementation 'junit:junit:4.13.2' androidTestImplementation 'androidx.test.ext:junit:1.1.5' androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1' }