小编Tor*_*rge的帖子

如何根据gradle风格设置变量

我想传递一个变量test,我为每个flavor设置不同的变量作为NDK的定义.但由于某种原因,他总是传递最后一种味道的价值.

这是build.gradle:

apply plugin: 'com.android.library'

def test

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"
    defaultPublishConfig "flavorARelease"
    publishNonDefault true

    defaultConfig {
        minSdkVersion 15
        targetSdkVersion 17

        ndk {
            moduleName "test"
            ldLibs "log"
        }
    }

    productFlavors {    
        flavorA {
            test = 1
        }

        flavorB {
            test = 2
        }    
    }

    buildTypes {    
        debug {
            ndk {
                if (cFlags == null) { cFlags = "" }
                cFlags = cFlags + " -DLOGGING=1 -DTEST="+test+" "
            }
            minifyEnabled false
        }
        release {
            ndk {
                if …
Run Code Online (Sandbox Code Playgroud)

android gradle android-ndk cflags

20
推荐指数
2
解决办法
8336
查看次数

如何摆脱 TreeMap 的 eclipse neon 中的“空类型安全”警告

如何消除此示例代码中的警告。

我将 Eclipse Neon 与 Java 1.8 和 org.eclipse.jdt.annotation_2.1.0 结合使用

import java.util.Iterator;
import java.util.Map.Entry;
import java.util.Set;
import java.util.TreeMap;

import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;

@NonNullByDefault
public class NullAnnotationTest4 {

    public static void main(String[] args) {

        final TreeMap<@Nullable Integer, @Nullable String> treeMap = new TreeMap<>();

        treeMap.put(3,  "Test1");
        treeMap.put(null, null);

        //This produces the warning
        final Set<@Nullable Entry<@Nullable Integer, @Nullable String>> set = treeMap.entrySet();

        for (final Iterator<@Nullable Entry<@Nullable Integer, @Nullable String>> it = set.iterator(); it.hasNext(); ) {

            final Entry<@Nullable Integer, @Nullable String> entry = it.next(); …
Run Code Online (Sandbox Code Playgroud)

java eclipse non-nullable java-annotations

2
推荐指数
1
解决办法
2441
查看次数