Buggy code:
private static final String LIBS_DIR_NAME = "libs" ; private static final String APK_LIB_DIR_NAME = "lib" ; private static final String ARMEABI_DIR_NAME = "armeabi" ; private static final String ARMEABI_V7A_DIR_NAME = "armeabi-v7a" ; private static final String DEFAULT_ICON = ( Compiler . RUNTIME_FILES_DIR ) + "ya.png" ; private static final String DEFAULT_VERSION_CODE = "1" ; private static final String DEFAULT_VERSION_NAME = "1.0" ; private static final String DEFAULT_APP_NAME = "" ; private static final String COMPONENT_BUILD_INFO = ( Compiler . RUNTIME_FILES_DIR ) + "simple_components_build_info.json" ; private static final String SIMPLE_ANDROID_RUNTIME_JAR = ( Compiler . RUNTIME_FILES_DIR ) + "AndroidRuntime.jar" ; private static final String ANDROID_RUNTIME = ( Compiler . RUNTIME_FILES_DIR ) + "android.jar" ; private static final String MAC_AAPT_TOOL = "//tools//mac//aapt" ; private static final String WINDOWS_AAPT_TOOL = "//tools//windows//aapt" ; private static final String LINUX_AAPT_TOOL = "//tools//linux//aapt" ; private static final String KAWA_RUNTIME = ( Compiler . RUNTIME_FILES_DIR ) + "kawa.jar" ; private static final String ACRA_RUNTIME = ( Compiler . RUNTIME_FILES_DIR ) + "acra-4.4.0.jar" ; private static final String DX_JAR = ( Compiler . RUNTIME_FILES_DIR ) + "dx.jar" ; @ VisibleForTesting static final String YAIL_RUNTIME = ( Compiler . RUNTIME_FILES_DIR ) + "runtime.scm" ; private static final String MAC_ZIPALIGN_TOOL = "//tools//mac//zipalign" ; private static final String WINDOWS_ZIPALIGN_TOOL = "//tools//windows//zipalign" ; private static final String LINUX_ZIPALIGN_TOOL = "//tools//linux//zipalign" ; private static final Logger LOG = Logger . getLogger ( Compiler . class . getName ( ) ) ; private final ConcurrentMap < String , Set < String > > componentPermissions = new ConcurrentHashMap < String , Set < String > > ( ) ; private final ConcurrentMap < String , Set < String > > componentLibraries = new ConcurrentHashMap < String , Set < String > > ( ) ; private final ConcurrentMap < String , Set < String > > componentNativeLibraries = new ConcurrentHashMap < String , Set < String > > ( ) ; private final ConcurrentMap < String , Set < String > > componentAssets = new ConcurrentHashMap < String , Set < String > > ( ) ; private static final ConcurrentMap < String , File > resources = new ConcurrentHashMap < String , File > ( ) ; private static final String ERROR_IN_STAGE = "Error:<seq2seq4repair_space>Your<seq2seq4repair_space>build<seq2seq4repair_space>failed<seq2seq4repair_space>due<seq2seq4repair_space>to<seq2seq4repair_space>an<seq2seq4repair_space>error<seq2seq4repair_space>in<seq2seq4repair_space>the<seq2seq4repair_space>%s<seq2seq4repair_space>stage,<seq2seq4repair_space>" + "not<seq2seq4repair_space>because<seq2seq4repair_space>of<seq2seq4repair_space>an<seq2seq4repair_space>error<seq2seq4repair_space>in<seq2seq4repair_space>your<seq2seq4repair_space>program.\n" ; private static final String ICON_ERROR = "Error:<seq2seq4repair_space>Your<seq2seq4repair_space>build<seq2seq4repair_space>failed<seq2seq4repair_space>because<seq2seq4repair_space>%s<seq2seq4repair_space>cannot<seq2seq4repair_space>be<seq2seq4repair_space>used<seq2seq4repair_space>as<seq2seq4repair_space>the<seq2seq4repair_space>application<seq2seq4repair_space>icon.\n" ; private static final String NO_USER_CODE_ERROR = "Error:<seq2seq4repair_space>No<seq2seq4repair_space>user<seq2seq4repair_space>code<seq2seq4repair_space>exists.\n" ; private static final String COMPILATION_ERROR = "Error:<seq2seq4repair_space>Your<seq2seq4repair_space>build<seq2seq4repair_space>failed<seq2seq4repair_space>due<seq2seq4repair_space>to<seq2seq4repair_space>an<seq2seq4repair_space>error<seq2seq4repair_space>when<seq2seq4repair_space>compiling<seq2seq4repair_space>%s.\n" ; private final Project project ; private final Set < String > componentTypes ; private final PrintStream out ; private final PrintStream err ; private final PrintStream userErrors ; private final boolean isForCompanion ; private final int childProcessRamMb ; private Set < String > librariesNeeded ; private Set < String > nativeLibrariesNeeded ; private Set < String > assetsNeeded ; private File libsDir ; private String dexCacheDir ; @ VisibleForTesting Set < String > generatePermissions ( ) { } @ VisibleForTesting void generateLibraryNames ( ) { } @ VisibleForTesting void generateNativeLibraryNames ( ) { } @ VisibleForTesting void generateAssets ( ) { } private String cleanVname ( String vname ) { } private boolean writeAndroidManifest ( File manifestFile , Set < String > permissionsNeeded ) { String mainClass = project . getMainClass ( ) ; String packageName = Signatures . getPackageName ( mainClass ) ; String className = Signatures . getClassName ( mainClass ) ; String projectName = project . getProjectName ( ) ; String vCode = ( ( project . getVCode ( ) ) == null ) ? Compiler . DEFAULT_VERSION_CODE : project . getVCode ( ) ; String vName = ( ( project . getVName ( ) ) == null ) ? Compiler . DEFAULT_VERSION_NAME : cleanVname ( project . getVName ( ) ) ; String aName = ( ( project . getAName ( ) ) == null ) ? Compiler . DEFAULT_APP_NAME : project . getAName ( ) ; Compiler . LOG . log ( Level . INFO , ( "VCode:<seq2seq4repair_space>" + ( project . getVCode ( ) ) ) ) ; Compiler . LOG . log ( Level . INFO , ( "VName:<seq2seq4repair_space>" + ( project . getVName ( ) ) ) ) ; try { <START_BUG> BufferedWriter out = new BufferedWriter ( new FileWriter ( manifestFile ) ) ; <END_BUG> out . write ( "<?xml<seq2seq4repair_space>version=\"1.0\"<seq2seq4repair_space>encoding=\"utf-8\"?>\n" ) ; out . write ( ( ( ( ( ( ( ( ( ( ( "<manifest<seq2seq4repair_space>" + ( "xmlns:android=\"http:////schemas.android.com//apk//res//android\"<seq2seq4repair_space>" + "package=\"" ) ) + packageName ) + "\"<seq2seq4repair_space>" ) + "android:versionCode=\"" ) + vCode ) + "\"<seq2seq4repair_space>" ) + "android:versionName=\"" ) + vName ) + "\"<seq2seq4repair_space>" ) + ">\n" ) ) ; if ( isForCompanion ) { out . write ( "<seq2seq4repair_space><uses-feature<seq2seq4repair_space>android:name=\"android.hardware.bluetooth\"<seq2seq4repair_space>android:required=\"false\"<seq2seq4repair_space>//>\n" ) ; out . write ( "<seq2seq4repair_space><uses-feature<seq2seq4repair_space>android:name=\"android.hardware.location\"<seq2seq4repair_space>android:required=\"false\"<seq2seq4repair_space>//>\n" ) ; out . write ( "<seq2seq4repair_space><uses-feature<seq2seq4repair_space>android:name=\"android.hardware.telephony\"<seq2seq4repair_space>android:required=\"false\"<seq2seq4repair_space>//>\n" ) ; out . write ( "<seq2seq4repair_space><uses-feature<seq2seq4repair_space>android:name=\"android.hardware.location.network\"<seq2seq4repair_space>android:required=\"false\"<seq2seq4repair_space>//>\n" ) ; out . write ( "<seq2seq4repair_space><uses-feature<seq2seq4repair_space>android:name=\"android.hardware.location.gps\"<seq2seq4repair_space>android:required=\"false\"<seq2seq4repair_space>//>\n" ) ; out . write ( "<seq2seq4repair_space><uses-feature<seq2seq4repair_space>android:name=\"android.hardware.microphone\"<seq2seq4repair_space>android:required=\"false\"<seq2seq4repair_space>//>\n" ) ; out . write ( "<seq2seq4repair_space><uses-feature<seq2seq4repair_space>android:name=\"android.hardware.touchscreen\"<seq2seq4repair_space>android:required=\"false\"<seq2seq4repair_space>//>\n" ) ; out . write ( "<seq2seq4repair_space><uses-feature<seq2seq4repair_space>android:name=\"android.hardware.camera\"<seq2seq4repair_space>android:required=\"false\"<seq2seq4repair_space>//>\n" ) ; out . write ( "<seq2seq4repair_space><uses-feature<seq2seq4repair_space>android:name=\"android.hardware.camera.autofocus\"<seq2seq4repair_space>android:required=\"false\"<seq2seq4repair_space>//>\n" ) ; out . write ( "<seq2seq4repair_space><uses-feature<seq2seq4repair_space>android:name=\"android.hardware.wifi\"<seq2seq4repair_space>//>\n" ) ; } for ( String permission : permissionsNeeded ) { out . write ( ( ( "<seq2seq4repair_space><uses-permission<seq2seq4repair_space>android:name=\"" + permission ) + "\"<seq2seq4repair_space>//>\n" ) ) ; } out . write ( "<seq2seq4repair_space><uses-sdk<seq2seq4repair_space>android:minSdkVersion=\"3\"<seq2seq4repair_space>//>\n" ) ; out . write ( "<seq2seq4repair_space><application<seq2seq4repair_space>" ) ; out . write ( "android:debuggable=\"false\"<seq2seq4repair_space>" ) ; if ( aName . equals ( "" ) ) { out . write ( ( ( "android:label=\"" + projectName ) + "\"<seq2seq4repair_space>" ) ) ; } else { out . write ( ( ( "android:label=\"" + aName ) + "\"<seq2seq4repair_space>" ) ) ; } out . write ( "android:icon=\"@drawable//ya\"<seq2seq4repair_space>" ) ; if ( isForCompanion ) { out . write ( "android:name=\"com.google.appinventor.components.runtime.ReplApplication\"<seq2seq4repair_space>" ) ; } out . write ( ">\n" ) ; for ( Project . SourceDescriptor source : project . getSources ( ) ) { String formClassName = source . getQualifiedName ( ) ; boolean isMain = formClassName . equals ( mainClass ) ;

Fix:
BufferedWriter out = new BufferedWriter ( new OutputStreamWriter ( new FileOutputStream ( manifestFile ) , "UTF-8" ) ) ;