我一直在尝试新的Android构建系统,我遇到了一个小问题.我已经编译了自己的ActionBarSherlock的aar包,我称之为'actionbarsherlock.aar'.我正在尝试做的实际上是使用这个aar来构建我的最终APK.如果我使用编译项目(':actionbarsherlock')将整个ActionBarSherlock库作为android-library模块包含到我的主项目中,我可以成功构建而没有任何问题.
但我的问题是,我想将该依赖项作为aar文件包手动提供,如果我想要一个JAR,那么我似乎无法弄清楚如何正确地将它包含到我的项目中.我试图使用编译配置,但这似乎不起作用.我继续在编译期间找不到符号,这告诉我来自aar包的classes.jar没有包含在类路径中.
有谁知道手动将aar包作为文件包含的语法?
的build.gradle
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.4'
}
}
apply plugin: 'android'
repositories {
mavenCentral()
}
dependencies {
compile files('libs/actionbarsherlock.aar')
}
android {
compileSdkVersion 15
buildToolsVersion "17.0"
}
Run Code Online (Sandbox Code Playgroud)
编辑:所以答案是它目前不支持,如果你想跟踪它,这是问题.
编辑:目前仍然没有直接支持,最好的替代方案似乎是来自@RanWakshlak的建议解决方案
编辑:使用@VipulShah提出的语法也更简单
我想要编写一个充当蓝牙客户端的应用程序.我想要做的是弄清楚什么是最好的方法来判断我支持的特定设备是否在范围内,而不是一直尝试对其进行BluetoothDevice.connect()并且失败如果它不在范围内 这里我们假设设备已经配对.
我担心尝试连接到特定设备直到它在范围内是不好的做法.在我看来这对电池来说会有坏处.
有谁知道应该用来完成我想要做的事情的任何方法或概念?
谢谢!
我在此代码上收到错误"无法解析符号MainActivity".
<activity
android:name=".MainActivity" //here
android:label="@string/app_name"
android:launchMode="singleTask" >
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="MainActivity"
android:scheme="callback" />
</intent-filter>
</activity>
Run Code Online (Sandbox Code Playgroud)
毋庸置疑,MainActivity继承了Activity,包名也是正确的.
为什么?
谢谢
这是目录结构的图像.
我一直在尝试使用ICS中ActionBar的setActionView
看起来它应该是直截了当但不知何故我没有得到我希望的布局对齐.如下图所示,"目标"图标在其布局中正确居中.但是当我setActionBar(progress)时,无论我尝试什么,进度视图总是与右边对齐.
在单击菜单项之前和之后,有两种状态.如您所见,进度视图始终与右侧对齐.我已经尝试将我的进度布局xml中的重力选项从左到右更改为中心,无论我做什么改变它似乎都没有改变任何东西.
我没有找到关于这个问题的任何信息,所以我想我一定做错了.
有人有线索吗?谢谢您的帮助!
这是我的操作栏菜单布局'action_bar_menu.xml'
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/locate"
android:title="locate"
android:icon="@drawable/locate"
android:showAsAction="ifRoom|withText" />
</menu>
Run Code Online (Sandbox Code Playgroud)
这是我的进度条布局'inderterminate_progress.xml'
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center">
<ProgressBar android:layout_width="25dp"
android:layout_height="25dp"
android:layout_gravity="center"
android:indeterminate="true"
style="?android:attr/progressBarStyleInverse"/>
</FrameLayout>
Run Code Online (Sandbox Code Playgroud)
最后这是我的testx活动
public class HelloAndroidActivity extends Activity {
/**
* Called when the activity is first created.
* @param savedInstanceState If the activity is being re-initialized after
* previously being shut down then this Bundle contains the data it most
* recently supplied in onSaveInstanceState(Bundle). <b>Note: Otherwise it is null.</b> …
Run Code Online (Sandbox Code Playgroud) android ×4
android-4.0-ice-cream-sandwich ×1
bluetooth ×1
build.gradle ×1
gradle ×1
java ×1
manifest ×1