GVKun编程网logo

ubuntu-android--You are attempting to build on ...

8

对于想了解ubuntu-android--Youareattemptingtobuildon...的读者,本文将提供新的信息,并且为您提供关于androidcreatebuild.xmlunderub

对于想了解ubuntu-android--You are attempting to build on ...的读者,本文将提供新的信息,并且为您提供关于android create build.xml under ubuntu、Android Studio中的Flutter:Build Bundle / APK变灰、android studio升级之后项目报错Could not find com.android.tools.build:aapt2:3.2.1-4818971、android – NotificationCompat.Builder中是否需要setContentIntent(PendingIntent)?的有价值信息。

本文目录一览:

ubuntu-android--You are attempting to build on ...

ubuntu-android--You are attempting to build on ...

root@tianbaoxing-virtual-machine:/home/Android# make
============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=2.3.1
TARGET_PRODUCT=generic
TARGET_BUILD_VARIANT=eng
TARGET_SIMULATOR=
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
HOST_ARCH=x86
HOST_OS=linux
HOST_BUILD_TYPE=release
BUILD_ID=GRH78
============================================
Checking build tools versions...
build/core/main.mk:76: ************************************************************
build/core/main.mk:77: You are attempting to build on a 32-bit system.
build/core/main.mk:78: Only 64-bit build environments are supported beyond froyo/2.2.
build/core/main.mk:79: ************************************************************
build/core/main.mk:80: *** stop。 停止。

root@tianbaoxing-virtual-machine:/home/Android#

解决办法:

(1) 找到 build/core/main.mk 文件,找到下面的代码段:

ifeq ($(BUILD_OS),linux)
build_arch := $(shell uname -m)
ifneq (64,$(findstring 64,$(build_arch)))
$(warning ************************************************************)
$(warning You are attempting to build on a 32-bit system.)
$(warning Only 64-bit build environments are supported beyond froyo/2.2.)
$(warning ************************************************************)

将第三行修改成 ifneq (i686,$(findstring i686,$(build_arch)))

(2)找到下面的这几个文件:

    /external/clearsilver/cgi/Android.mk

     /external/clearsilver/cs/Android.mk
     /external/clearsilver/java-jni/Android.mk

     /external/clearsilver/util/Android.mk

修改其中的代码段: LOCAL_CFLAGS += -m64

     LOCAL_LDFLAGS += -m64

改成:

LOCAL_CFLAGS += -m32

     LOCAL_LDFLAGS += -m32







android create build.xml under ubuntu

android create build.xml under ubuntu

Terminal : build.xml does not exist!

Mothed:

$ android update project -p . -t 8
$ ant debug

If it can''t layout a successful message.

Try:

$ ant clean 
$ ant clean debug


Android Studio中的Flutter:Build Bundle / APK变灰

Android Studio中的Flutter:Build Bundle / APK变灰

我在这里的以下链接中安装了Flutter和Android Studio:https:
//flutter.dev/docs/get-started/editor

我已经在Flutter中编码了两个月了,可以在模拟器
或连接的设备上运行我的应用程序了,没有问题。

但是,当我尝试通过“ Build”(构建)–>“ Build Bundle(s)/
APK (构建捆绑包/ APK )”构建一个APK时,此选项显示为灰色。

Android Studio:3.3.2

android studio升级之后项目报错Could not find com.android.tools.build:aapt2:3.2.1-4818971

android studio升级之后项目报错Could not find com.android.tools.build:aapt2:3.2.1-4818971

导致问题的原因为源代码根目录下的build.gradle中缺少对于google源服务器的配置(话说,貌似以前版本的都在jcenter中可以找到,最新版本的,好像没有上传到jcenter服务器了,估计是google的商业策略了,在此不多做评述)

下面增加

google()

增改后如下

// Top-level build file where you can add configuration options common to all sub-projects/modules.

  buildscript {     repositories {         google()         jcenter()     }     dependencies {         classpath 'com.android.tools.build:gradle:3.1.3'     } }   allprojects {     repositories {         google()         jcenter()     } }

android – NotificationCompat.Builder中是否需要setContentIntent(PendingIntent)?

android – NotificationCompat.Builder中是否需要setContentIntent(PendingIntent)?

致电:
public static void triggerTestNotification(Context ctx,String tag,int id) {
    Notification not = new NotificationCompat.Builder(ctx)
        .setContentTitle("Title").setContentText("Text")
        .setAutoCancel(true) // cancel on click
        .setSmallIcon(R.drawable.ic_launcher).build();
    notificationmanager notificationmanager = (notificationmanager) ctx
        .getSystemService(Context.NOTIFICATION_SERVICE);
    notificationmanager.notify(tag,id,not);
}

在我的主要活动的onCreate()中产生:

11-17 15:58:46.198: E/AndroidRuntime(1507): FATAL EXCEPTION: main
11-17 15:58:46.198: E/AndroidRuntime(1507): java.lang.RuntimeException: Unable to start activity ComponentInfo{gr.uoa.di.monitoring.android/gr.uoa.di.monitoring.android.activities.MainActivity}: java.lang.IllegalArgumentException: contentIntent required: pkg=gr.uoa.di.monitoring.Android id=0 notification=Notification(vibrate=null,sound=null,defaults=0x0,flags=0x10)
//...
11-17 15:58:46.198: E/AndroidRuntime(1507): Caused by: java.lang.IllegalArgumentException: contentIntent required: pkg=gr.uoa.di.monitoring.Android id=0 notification=Notification(vibrate=null,flags=0x10)
11-17 15:58:46.198: E/AndroidRuntime(1507):     at android.os.Parcel.readException(Parcel.java:1326)
11-17 15:58:46.198: E/AndroidRuntime(1507):     at android.os.Parcel.readException(Parcel.java:1276)
11-17 15:58:46.198: E/AndroidRuntime(1507):     at android.app.Inotificationmanager$Stub$Proxy.enqueueNotificationWithTag(Inotificationmanager.java:274)
11-17 15:58:46.198: E/AndroidRuntime(1507):     at android.app.notificationmanager.notify(notificationmanager.java:133)
11-17 15:58:46.198: E/AndroidRuntime(1507):     at gr.uoa.di.monitoring.android.C.triggerTestNotification(C.java:200)
11-17 15:58:46.198: E/AndroidRuntime(1507):     at gr.uoa.di.monitoring.android.activities.MainActivity.onCreate(MainActivity.java:44)
11-17 15:58:46.198: E/AndroidRuntime(1507):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
11-17 15:58:46.198: E/AndroidRuntime(1507):     at android.app.ActivityThread.performlaunchActivity(ActivityThread.java:1722)
11-17 15:58:46.198: E/AndroidRuntime(1507):     ... 11 more

注意需要contentIntent.

但是文档could not be more clear:

required notification contents

A Notification object must contain the following:

  • A small icon,set by setSmallIcon()

  • A title,set by setContentTitle()

  • Detail text,set by setContentText()

Optional notification contents and settings

All other notification settings and contents are optional. To learn more about them,see the reference documentation for NotificationCompat.Builder.

该意见反映在various SO answers中,结果为SO questions(和another之一).

解决方法:

final Intent emptyIntent = new Intent();
PendingIntent pi = PendingIntent.getActivity(ctx,NOT_USED,emptyIntent,PendingIntent.FLAG_UPDATE_CURRENT);
//...
.setContentIntent(pi).build;

但这真的需要吗?这种情况是否是另一个Android docs的bug?它依赖于API吗?

注意我的目标SDK是17并在2.3.7手机上运行

解决方法

如果您使用像waybackmachine这样的缓存服务并且查找了 previous versions的通知指南,您将看到该指南确实告诉您contentIntent是必需的.

这也反映在Android源中. notificationmanagerService在显示通知之前处理通知的检查.

Gingerbread中,作为enqueueNotificationInternal()方法的一部分,它具有以下检查:

if (notification.icon != 0) {
    if (notification.contentView == null) {
          throw new IllegalArgumentException("contentView required: pkg=" + pkg
                    + " id=" + id + " notification=" + notification);
    }
    if (notification.contentIntent == null) {
        throw new IllegalArgumentException("contentIntent required: pkg=" + pkg
                + " id=" + id + " notification=" + notification);
    }
}

在以后的Android版本中,例如Ice Cream Sandwich,该检查已经消失:

if (notification.icon != 0) {
    if (notification.contentView == null) {
       throw new IllegalArgumentException("contentView required: pkg=" + pkg
              + " id=" + id + " notification=" + notification);
    }
}

因此,Gingerbread及以下需要contentIntent.

今天关于ubuntu-android--You are attempting to build on ...的分享就到这里,希望大家有所收获,若想了解更多关于android create build.xml under ubuntu、Android Studio中的Flutter:Build Bundle / APK变灰、android studio升级之后项目报错Could not find com.android.tools.build:aapt2:3.2.1-4818971、android – NotificationCompat.Builder中是否需要setContentIntent(PendingIntent)?等相关知识,可以在本站进行查询。

本文标签: