Thursday, January 7, 2016

List supported ABIs

Example list Android devices SUPPORTED_ABIS, SUPPORTED_32_BIT_ABIS and SUPPORTED_64_BIT_ABIS.

Run on Emulator with Intel x86_64

Run on device, Nexus 7, with 32-bit ARM CPU
MainActivity.java
package com.blogspot.android_er.androidsupportedabis;

import android.os.Build;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.TextView;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        TextView textSupportedABIs = (TextView)findViewById(R.id.supportedabis);

        textSupportedABIs.setText("Build.SUPPORTED_ABIS:\n");
        String[] SUPPORTED_ABIS = Build.SUPPORTED_ABIS;
        for(String abi : SUPPORTED_ABIS){
            textSupportedABIs.append(abi + "\n");
        }
        textSupportedABIs.append("\n");

        textSupportedABIs.append("Build.SUPPORTED_32_BIT_ABIS:\n");
        String[] SUPPORTED_32_BIT_ABIS = Build.SUPPORTED_32_BIT_ABIS;
        for(String abi32 : SUPPORTED_32_BIT_ABIS){
            textSupportedABIs.append(abi32 + "\n");
        }
        textSupportedABIs.append("\n");

        textSupportedABIs.append("Build.SUPPORTED_64_BIT_ABIS:\n");
        String[] SUPPORTED_64_BIT_ABIS = Build.SUPPORTED_64_BIT_ABIS;
        for(String abi64 : SUPPORTED_64_BIT_ABIS){
            textSupportedABIs.append(abi64 + "\n");
        }
        textSupportedABIs.append("\n");
    }
}


<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:padding="16dp"
    android:orientation="vertical"
    tools:context="com.blogspot.android_er.androidsupportedabis.MainActivity">

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_horizontal"
        android:autoLink="web"
        android:text="http://android-er.blogspot.com/"
        android:textStyle="bold" />

    <TextView
        android:id="@+id/supportedabis"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />
</LinearLayout>




Related:
Display ABI using "adb shell getprop ro.product.cpu.abi" command

No comments: