小编Md *_*sin的帖子

模块"app"是一个没有构建变体的Android项目

我在导入android项目时遇到错误.

错误:模块"app"是一个没有构建变体的Android项目,无法构建.请修复build.gradle文件中的模块配置并再次同步项目.

Gradle文件代码.

apply plugin: 'com.android.application'

android {
compileSdkVersion 25
buildToolsVersion "25.0.3"

defaultConfig {
    applicationId "com.djalel.android.bilal"
    minSdkVersion 9
    targetSdkVersion 25
    versionCode 4
    versionName "1.3"
}

buildTypes {
    release {
        minifyEnabled true
        proguardFiles getDefaultProguardFile('proguard-android.txt')
    }
}

aaptOptions {
    cruncherEnabled = false
}
}

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:25.3.1'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:design:25.3.1'
implementation 'com.android.support:support-v4:25.3.1'
implementation 'com.google.android.gms:play-services-location:12.0.1'
implementation 'com.readystatesoftware.sqliteasset:sqliteassethelper:2.0.1'
implementation 'com.jakewharton.timber:timber:3.1.0'
}
repositories {
mavenCentral()
}
Run Code Online (Sandbox Code Playgroud)

我检查了使用gradle文件,但是在这个项目中得到了同样的错误.

android android-studio android-gradle-plugin

29
推荐指数
3
解决办法
2万
查看次数

如何通过图中的给定路径覆盖最大节点数?

我试图通过给定图表中的路径找出覆盖节点的最大数量.我已经使用递归制作了一个程序,但它只给出了一些简单的图形,而不是复杂的图形.

输入以字符串数组(如1#2)给出:表示节点1连接到节点2,反之亦然.

我已经制作了一个总节点大小的矩阵,如果节点连接,则在矩阵中设置1,否则为-1.该矩阵用于计算路径中的最大覆盖节点.

码:

import java.io.*;
import java.util.*; 

public class Medium 
{ 
 public static int node_covered;
 public static int big=0;
 public static boolean[] visited;
 public static int matrix_length;
 public static String[][] matrix;

 public static String[] input=new String[]
 //answer is 7.
{"1#2", "2#3","3#4","3#5","5#6","5#7","6#7","7#8"};

public static void main(String[] args){
      int total_nodes=maxno_city(input);
      System.out.println(total_nodes);
  }

public static int maxno_city(String[] input1)
{
int ln=input1.length;
HashSet hs = new HashSet();

for(int i=0; i<ln;i++)
{
    String[] temp=input1[i].split("#");     
    hs.add(temp[0]);        
    hs.add(temp[1]);    
}

matrix_length=hs.size();
hs.clear();
matrix=new String[matrix_length][matrix_length];
//initialize matrix
for …
Run Code Online (Sandbox Code Playgroud)

java recursion data-structures

5
推荐指数
1
解决办法
500
查看次数