@Override
  public ManifestIdentifier identify(Config config) {
    Path manifestFile = getFileFromProperty("android_merged_manifest");
    Path resourcesDir = getFileFromProperty("android_merged_resources");
    Path assetsDir = getFileFromProperty("android_merged_assets");
    Path apkFile = getFileFromProperty("android_resource_apk");
    String packageName = properties.getProperty("android_custom_package");

    String manifestConfig = config.manifest();
    if (Config.NONE.equals(manifestConfig)) {
      Logger.info(
          "@Config(manifest = Config.NONE) specified while using Build System API, ignoring");
    } else if (!Config.DEFAULT_MANIFEST_NAME.equals(manifestConfig)) {
      manifestFile = getResource(manifestConfig);
    }

    if (!Config.DEFAULT_RES_FOLDER.equals(config.resourceDir())) {
      resourcesDir = getResource(config.resourceDir());
    }

    if (!Config.DEFAULT_ASSET_FOLDER.equals(config.assetDir())) {
      assetsDir = getResource(config.assetDir());
    }

    if (!Config.DEFAULT_PACKAGE_NAME.equals(config.packageName())) {
      packageName = config.packageName();
    }

    List<ManifestIdentifier> libraryDirs = emptyList();
    if (config.libraries().length > 0) {
      Logger.info("@Config(libraries) specified while using Build System API, ignoring");
    }

    return new ManifestIdentifier(
        packageName, manifestFile, resourcesDir, assetsDir, libraryDirs, apkFile);
  }
@Test
  public void identify_withResourceApk() {
    Properties properties = new Properties();
    properties.put("android_merged_manifest", "gradle/AndroidManifest.xml");
    properties.put("android_merged_resources", "gradle/res");
    properties.put("android_merged_assets", "gradle/assets");
    properties.put("android_resource_apk", "gradle/resources.ap_");
    DefaultManifestFactory factory = new DefaultManifestFactory(properties);
    ManifestIdentifier identifier = factory.identify(Config.Builder.defaults().build());
    AndroidManifest manifest = RobolectricTestRunner.createAndroidManifest(identifier);

    assertThat(manifest.getAndroidManifestFile())
        .isEqualTo(Paths.get("gradle/AndroidManifest.xml"));
    assertThat(manifest.getResDirectory()).isEqualTo(Paths.get("gradle/res"));
    assertThat(manifest.getAssetsDirectory()).isEqualTo(Paths.get("gradle/assets"));
    assertThat(manifest.getApkFile()).isEqualTo(Paths.get("gradle/resources.ap_"));
  }