我有4个gradle构建文件:当我在android studio中构建时,我经常出现以下错误:
没有方法的签名:org.gradle.model.ModelMap.getDefaultProguardFile()适用于参数类型:(java.lang.String)值:[proguard android.txt]
文件1
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle-experimental:0.9.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
文件2
apply plugin: 'com.android.model.native'
model {
android {
compileSdkVersion = 25
buildToolsVersion = '25.0.0'
defaultConfig {
minSdkVersion.apiLevel = 17
targetSdkVersion.apiLevel = 25
versionCode = 1
versionName = '1.0'
}
ndk {
moduleName = 'fpextractor'
platformVersion = 17
toolchain = "clang"
stl = 'gnustl_static' //std::mutex not in gnustl_static
cppFlags.add('-std=c++11')
abiFilters.addAll(['armeabi', 'armeabi-v7a', 'x86'])
//abiFilters.addAll(['armeabi', 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64', 'mips', 'mips64']) //this is default
//abiFilters.addAll(['armeabi'])
ldLibs.addAll(['android', 'log', 'atomic', 'z'])
}
}
}
// This is just copy out the header file and built lib into distribution
// directory for clint application to use; it is a small overhead of this sample:
// both lib and app are put inside one project space [save maintenance time]
task(distributeLib, type : Copy) {
// trigger build library
dependsOn assemble
into '../distribution/fpextractor/'
from('src/main/jni/fp_extractor.h') {
into 'include/'
}
from('build/outputs/native/release/lib') {
into 'lib/'
}
}
文件3
apply plugin: 'com.android.model.native'
model {
android {
compileSdkVersion = 25
buildToolsVersion = '25.0.0'
defaultConfig {
minSdkVersion.apiLevel = 17
targetSdkVersion.apiLevel = 25
versionCode = 1
versionName = '1.0'
}
ndk {
moduleName = 'nativeaudio'
platformVersion = 17
toolchain = "clang"
stl = 'gnustl_static' //std::mutex not in gnustl_static
cppFlags.add('-std=c++11')
abiFilters.addAll(['armeabi', 'armeabi-v7a', 'x86'])
//abiFilters.addAll(['armeabi', 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64', 'mips', 'mips64']) //this is default
//abiFilters.addAll(['armeabi-v7a'])
ldLibs.addAll(['android', 'log', 'OpenSLES', 'atomic'])
}
}
}
// This is just copy out the header file and built lib into distribution
// directory for clint application to use; it is a small overhead of this sample:
// both lib and app are put inside one project space [save maintenance time]
task(distributeLib, type : Copy) {
// trigger build library
dependsOn assemble
into '../distribution/nativeaudio/'
from('src/main/jni/buf_manager.h') {
into 'include/'
}
from('src/main/jni/android_debug.h') {
into 'include/'
}
from('src/main/jni/debug_utils.h') {
into 'include/'
}
from('src/main/jni/audio_common.h') {
into 'include/'
}
from('src/main/jni/audio_recorder.h') {
into 'include/'
}
from('build/outputs/native/release/lib') {
into 'lib/'
}
}
文件4
apply plugin: 'com.android.model.application'
// Root of 3rd party lib(s): location could be anywhere on the host system
def lib_distribution_root = '../distribution'
model {
repositories {
libs(PrebuiltLibraries) {
// Configure one pre-built lib: shared
nativeaudio {
// Inform Android Studio where header file dir for this lib
headers.srcDir "${lib_distribution_root}/nativeaudio/include"
// Inform Android Studio where lib is -- each ABI should have a lib file
binaries.withType(SharedLibraryBinary) {
sharedLibraryFile = file("${lib_distribution_root}/nativeaudio/lib/${targetPlatform.getName()}/libnativeaudio.so")
}
}
fpextractor {
// Inform Android Studio where header file dir for this lib
headers.srcDir "${lib_distribution_root}/fpextractor/include"
// Inform Android Studio where lib is -- each ABI should have a lib file
binaries.withType(SharedLibraryBinary) {
sharedLibraryFile = file("${lib_distribution_root}/fpextractor/lib/${targetPlatform.getName()}/libfpextractor.so")
}
}
// Configure another pre-built lib: shared;[change to static after Studio supports]
// static lib generation. USING static lib is supported NOW, for that case,
// simple change:
// SharedLibaryBinary --> StaticLibraryBinary
// sharedLibraryFile --> staticLibraryFile
// *.so --> *.a
//gperf {
// headers.srcDir "${lib_distribution_root}/gperf/include"
// binaries.withType(SharedLibraryBinary) {
// sharedLibraryFile = file("${lib_distribution_root}/gperf/lib/${targetPlatform.getName()}/libgperf.so")
// }
//}
}
}
android {
compileSdkVersion = 25
buildToolsVersion = '25.0.0'
defaultConfig {
applicationId='com.gfk.mediawatchapp'
minSdkVersion.apiLevel = 17
targetSdkVersion.apiLevel = 25
versionCode = 22
versionName = '255.0.4'
// Enabling multidex support.
//multiDexEnabled true
}
ndk {
platformVersion = 17
moduleName = 'mwlib'
toolchain = "clang"
stl = 'gnustl_static'
cppFlags.add('-std=c++11')
ldLibs.addAll(['android', 'log', 'OpenSLES', 'atomic'])
//build a default combined apk including all ABIs.
//abiFilters.addAll(['armeabi-v7a'])
abiFilters.addAll(['armeabi', 'armeabi-v7a', 'x86']) //this is default
}
sources {
main {
jni {
dependencies {
library 'nativeaudio' linkage 'shared'
library 'fpextractor' linkage 'shared'
// if gperf were *.a, change shared --> static
//library 'gperf' linkage 'shared'
}
}
jniLibs {
// for shared lib, lib need to be pushed to the target too
// Once libs are copied into app/src/main/jniLibs directory,
// Android Studio will pack them into APK's lib/ directory
// Here we like to avoid another duplication by pointing
// to the files that containing our libs' distribution location
// so the same file is used by compiler at host, also packed
// into APk to be used at Target (phone/tablet)
source {
srcDir "${lib_distribution_root}/nativeaudio/lib"
srcDir "${lib_distribution_root}/fpextractor/lib"
//srcDir "${lib_distribution_root}/gperf/lib"
}
}
}
}
buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles.add(file('proguard-android.txt'))
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
}
dependencies {
println rootProject.getName()
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:support-v4:25.3.1'
compile 'commons-net:commons-net:3.5'
//compile 'com.android.support:appcompat-v7:23.3.0'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support:cardview-v7:25.3.1'
compile 'com.android.support:recyclerview-v7:25.3.1'
compile 'com.google.android.gms:play-services-appindexing:9.8.0'
compile 'com.amazonaws:aws-android-sdk-core:2.4.2'
compile 'com.amazonaws:aws-android-sdk-s3:2.4.2'
compile 'com.amazonaws:aws-android-sdk-ddb:2.4.2'
compile 'com.amazonaws:aws-android-sdk-cognitoidentityprovider:2.4.2'
}
// Unnecessary dependency management:
// Make sure the libs are available when begin compiling application project
// This could be ignored because in real scenario, the pre-built libs are
// already given to us before creating application.
tasks.whenTaskAdded { task ->
if (task.name.contains('compile')) {
task.dependsOn ':nativeaudio:distributeLib'
task.dependsOn ':fpextractor:distributeLib'
}
}
请:有人能帮我理解为什么我总是以下错误:
没有方法的签名:org.gradle.model.ModelMap.getDefaultProguardFile()适用于参数类型:(java.lang.String)值:[proguard android.txt]
为我添加一个带有
jar {
manifest {
attributes 'Main-Class': com.package.to.main.Class
}
}
帮助。
请参见此处:使用Gradle创建可运行JAR
Gradle不包括getDefaultProguardFile(),因为默认情况下它没有任何版本的ProGuard配置。
您可以使用将行从proguard android.txt
移动到proguard rules.pro
,然后更改此行:
proguardFiles.add(file('proguard-android.txt'))
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
为此:
proguardFiles.add(file('proguard-rules.pro'))
我试图创建基于版本号的git提交,但在运行gradle时,我不断遇到以下错误(这在build.gradle文件中) 错误:
我已经尝试了网络上提供的所有解决方案,但都无效。请尽快提供帮助。同步错误: 生成文件“C:\Users\AH\U GL\Desktop\apps android commons\apps\Build”。格拉德尔线:149 评估项目“:app”时出现问题。 没有方法的签名:build_bacf6ncg9oj63qiyhi1id1rfi.android()适用于参数类型:(build_bacf6ncg
我已经将一个项目从eclipse导入到android studio,我遇到了这个问题,android studio 2.2.2,gradle 2.2.2。 错误:(6,1)评估项目时出现问题:“projectName”。 没有方法签名:java。lang.Boolean。call()适用于参数类型:(null)值:[null] 可能的解决方案:wError:(6,1)评估项目': project
我在Spring启动批量应用程序中升级Spring启动和gradle版本,如下所示, Spring靴-2.3.3。发布到2.6.7 Gradle-6.6至7.4.2 在构建项目时低于错误 建筑gradle如下所示 gradle包装。属性如下
问题:评估项目':app'时出现问题。 方法:build_dxc6m5s863o0nfrfjdg2bqjp.android()的签名不适用于参数类型:(build_dxc6m5s863o0nfrfjdg2bqjp$_run_closure1)值:[build_dxc6m5s863o0nfrfjdg2bqjp$_run_closure1@18112963] 分级文件:
我正在尝试将数据库中列表中的项作为行中的单个值插入。如何循环发送的有效负载并将所有项插入到单独的行中?我试着找例子,没有运气。我无法循环并插入数据库中的值。 这是有效载荷