Debugger fails to launch when using aapt package renaming

We would like to use the aapt option “–rename-manifest-package” (exposed in ant as “manifestpackage”) to generate multiple packages from the same source without needing to search-replace all references to the .R resources class. Unfortunately, the debugger seems to be expecting the MainActivity class to use the original package name.

For example: If I set package=“com.nvidia.originalname” in the AndroidManifest.xml, then use manifestpackage=“com.nvidia.renamedpackage” in build.xml, the debugger fails to launch with the error “Error: Activity class {com.nvidia.originalname/com.nvidia.originalname.MainActivity} does not exist.” I believe that is because the final name of the class is com.nvidia.renamedpackage/com.nvidia.originalname.MainActivity

Manually installing and running the apk works fine.

Note that I’d really prefer to just tell aapt to generate the .R class with a specific name (independent of the package name), but I cannot find any reference for how this can be done…

To test this feature, insert the following snippet into your build.xml. It is copied from C:\NVPACK\android-sdk-windows\tools\ant\build.xml and has the manifestpackage line added.

<target name="-package-resources" depends="-crunch">
    <!-- only package resources if *not* a library project -->
    <do-only-if-not-library elseText="Library project: do not package resources..." >
        <aapt executable="${aapt}"
                command="package"
                versioncode="${version.code}"
                versionname="${version.name}"
                debug="${build.is.packaging.debug}"
                manifest="${out.manifest.abs.file}"
                manifestpackage="com.nvidia.renamedpackage"
                assets="${asset.absolute.dir}"
                androidjar="${project.target.android.jar}"
                apkfolder="${out.absolute.dir}"
                nocrunch="${build.packaging.nocrunch}"
                resourcefilename="${resource.package.file.name}"
                resourcefilter="${aapt.resource.filter}"
                libraryResFolderPathRefid="project.library.res.folder.path"
                libraryPackagesRefid="project.library.packages"
                libraryRFileRefid="project.library.bin.r.file.path"
                previousBuildType="${build.last.target}"
                buildType="${build.target}"
                ignoreAssets="${aapt.ignore.assets}">
            <res path="${out.res.absolute.dir}" />
            <res path="${resource.absolute.dir}" />
            <!-- <nocompress /> forces no compression on any files in assets or res/raw -->
            <!-- <nocompress extension="xml" /> forces no compression on specific file extensions in assets and res/raw -->
        </aapt>
    </do-only-if-not-library>
</target>

In Nsight Tegra, you could create several configuration. You could specify different AndroidManifest.xml file location and build.xml location in debugging parts of each configuration respectively. you could make a fake AndroidManifest.xml for debugging.

Hello corysama,

We will implement specifying the package name for debugging in the future.