MCPcopy Index your code
hub / github.com/dodorare/android-manifest-rs

github.com/dodorare/android-manifest-rs @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
152 symbols 198 edges 43 files 8 documented · 5%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Android Manifest

CI Info Crate Info API Docs Crate

AndroidManifest serializer and deserializer for Rust. This library will also likely continue to stay up to date with the official AndroidManifest specification as changes happen.

# Cargo.toml
[dependencies]
android-manifest = "*"

Create AndroidManifest.xml by yourself:

let manifest = AndroidManifest {
    package: "com.example.toggletest".to_string(),
    version_code: Some(1),
    version_name: Some("1.0".to_string()),
    application: Application {
        allow_backup: Some(true.into())),
        icon: Some(MipmapOrDrawableResource::mipmap("ic_launcher", None)),
        label: Some(StringResourceOrString::resource("app_name", None)),
        theme: Some(StyleResource::new("AppTheme", None)),
        activity: vec![Activity {
            label: Some(StringResourceOrString::resource("app_name", None)),
            name: "com.example.toggletest.MainActivity".to_string(),
            intent_filter: vec![IntentFilter {
                action: vec![Action {
                    name: Some("android.intent.action.MAIN".to_string()),
                }],
                category: vec![Category {
                    name: Some("android.intent.category.LAUNCHER".to_string()),
                }],
                ..Default::default()
            }],
            ..Default::default()
        }],
        ..Default::default()
    },
    ..Default::default()
};
let serialized_manifest = android_manifest::to_string_pretty(&manifest).unwrap();

Or parse any AndroidManifest.xml file:

let xml = r#"
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
          package="com.example.toggletest"
          android:versionCode="1"
          android:versionName="1.0">
    <application android:allowBackup="true"
               android:icon="@drawable/ic_launcher"
               android:label="@string/app_name"
               android:theme="@style/AppTheme">
        <activity android:label="@string/app_name"
                  android:name="com.example.toggletest.MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>
</manifest>"#;
let manifest: AndroidManifest = android_manifest::from_str(xml).unwrap();

License

This project is licensed under Apache License, Version 2.0, (LICENSE or http://www.apache.org/licenses/LICENSE-2.0).

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in toml-rs by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Extension points exported contracts — how you extend this code

ResourceType (Interface)
Trait implemented by types that can be used as resource. [5 implementers]
src/resources/mod.rs
Delimiter (Interface)
(no doc) [2 implementers]
src/attribute_list.rs

Core symbols most depended-on inside this repo

is_empty
called by 14
src/attribute_list.rs
from_str
called by 7
src/lib.rs
parse_resource_with_type
called by 5
src/resources/mod.rs
to_string
called by 4
src/lib.rs
to_string_pretty
called by 2
src/lib.rs
vec
called by 2
src/attribute_list.rs
parse_list_with_delimiter
called by 2
src/attribute_list.rs
parse_resource
called by 2
src/resources/mod.rs

Shape

Method 61
Class 50
Enum 24
Function 15
Interface 2

Languages

Rust100%

Modules by API surface

src/attribute_list.rs17 symbols
src/resources/mod.rs16 symbols
src/var_or_bool.rs13 symbols
src/activity.rs13 symbols
src/resources/res_or_string.rs10 symbols
src/resources/mipmap_or_drawable.rs10 symbols
src/resources/any.rs8 symbols
src/resources/types.rs7 symbols
src/queries.rs5 symbols
src/lib.rs5 symbols
src/uses_configuration.rs4 symbols
src/compatible_screens.rs3 symbols

For agents

$ claude mcp add android-manifest-rs \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact