简体   繁体   English

Android Studio和Favourites-无法查看所有文件

[英]Android studio and flavours - can not see all files

I am trying to set up flavours, so I can build different apps in he same project that share the same code... But I am not sure I am doing it fully correct... 我正在尝试设置风味,因此我可以在他的项目中构建共享相同代码的不同应用...但是我不确定我是否完全正确...

I have created a project called com.sharedid.app in folder W:\\android-studio-projects\\sharedid\\ 我在文件夹W:\\ android-studio-projects \\ sharedid \\中创建了一个名为com.sharedid.app的项目。

For this I have 为此,我有

1) Created AndroidManifest.xml in W:\\android-studio-projects\\sharedid\\app\\src\\main looking like this: 1)在W:\\ android-studio-projects \\ sharedid \\ app \\ src \\ main中创建AndroidManifest.xml,如下所示:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="com.sharedid.app"
  android:versionCode="1"
  android:versionName="1.0"
>
</manifest>

2) In W:\\android-studio-projects\\sharedid\\app\\src\\main\\java ... I have all .java files 2)在W:\\ android-studio-projects \\ sharedid \\ app \\ src \\ main \\ java ...我拥有所有.java文件

3) In W:\\android-studio-projects\\sharedid\\app\\src\\main\\res I have all shared and/or dummy resources 3)在W:\\ android-studio-projects \\ sharedid \\ app \\ src \\ main \\ res中,我拥有所有共享和/或虚拟资源

For my flavour I have: 对于我的口味,我有:

1) I have created AndroidManifest.xml in W:\\android-studio-projects\\sharedid\\app\\src\\myflavour (this file is what defines everything - it is unqiue for each flavour) 1)我在W:\\ android-studio-projects \\ sharedid \\ app \\ src \\ myflavor中创建了AndroidManifest.xml(此文件定义了所有内容-每种风味都不统一)

2) In W:\\android-studio-projects\\sharedid\\app\\src\\myflavour\\res I have a single folder drawable-hdpi conttaining variois graphics 2)在W:\\ android-studio-projects \\ sharedid \\ app \\ src \\ myflavor \\ res中,我有一个包含可绘制图形的可绘制的hdpi文件夹

3) In W:\\android-studio-projects\\sharedid\\app\\src\\myflavour\\assets I have all sorts of data, configuration and graphic files for that specifc app. 3)在W:\\ android-studio-projects \\ sharedid \\ app \\ src \\ myflavor \\ assets中,我具有特定应用程序的各种数据,配置和图形文件。 (read by the code at runtime) (在运行时由代码读取)

Here's how "Gradle Scripts" - "Build Gradle" (Module: app) looks like: 这是“ Gradle Scripts”-“ Build Gradle”(模块:app)的样子:

apply plugin: 'com.android.application'

android {
    signingConfigs {
    }
    compileSdkVersion 21
    buildToolsVersion '21.1.2'
    defaultConfig {
        applicationId "com.sharedid.app"
        minSdkVersion 9
        targetSdkVersion 17
    }
    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'
        }
    }
    repositories {
        maven { url "https://jitpack.io" }
    }     
    productFlavors {
      myflavour {
          applicationId "com.myflavour.app"
      }
    }           
}    
dependencies {
    compile 'com.android.support:support-v4:18.0.0'
    compile 'com.google.android.gms:play-services:+'
    compile 'com.android.support:appcompat-v7:21.1.2'
    compile 'com.github.PhilJay:MPAndroidChart:v2.0.8'
}

My problem is that when working in Android Studio, it currently does not show my any of the "myflavour" in the "project view" listing the files structure of the project? 我的问题是 ,在Android Studio中工作时,当前在列出项目文件结构的“项目视图”中没有显示我的任何“ myflavor”吗?

Which view are you in? 您在哪个视图中? Android or Project? Android还是Project? If you are in Android view, switch to Project view. 如果您在Android视图中,请切换到“项目”视图。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM