我正在使用Android Studio关注Facebook SDK for Android.当我运行我的应用程序时,我收到了下面提到的警告.
Gradle: module 'facebook' won't be compiled. Unfortunately you can't have non-Gradle Java module and Android-Gradle module in one project.
Run Code Online (Sandbox Code Playgroud)
我该怎么解决这个问题?
我尝试了@Scott Barta的回答,并收到以下错误消息.
A problem occurred configuring project ':App'.
> Failed to notify project evaluation listener.
> A problem occurred configuring project ':libraries:facebook'.
> Failed to notify project evaluation listener.
> Could not resolve all dependencies for configuration ':libraries:facebook:_DebugCompile'.
> Could not find any version that matches com.android.support:support-v4:+.
Required by:
MyApplication2.libraries:facebook:unspecified
Run Code Online (Sandbox Code Playgroud) android facebook facebook-android-sdk android-studio android-gradle-plugin
在发布我的问题之前,我看到了许多与此相关的线程.但没有一个对我有用.我有一个RelativeLayout与许多其他布局和片段作为孩子.我想在单击按钮时禁用"content_view"的所有子项以及content_view本身.我试过了
contentView.setDisabled(false);
Run Code Online (Sandbox Code Playgroud)
这没用.我也试过了
for (int i = 0; i < layout.getChildCount(); i++) {
View child = layout.getChildAt(i);
child.setEnabled(false);
}
Run Code Online (Sandbox Code Playgroud)
即使这样也行不通.我究竟做错了什么?请在下面找到我的.xml代码.我甚至尝试在所有视图上方放置一个视图.即使这并没有解决我的问题.
<RelativeLayout
android:layout_height="match_parent"
android:layout_width="match_parent"
android:orientation="vertical"
android:id="@+id/content_view"
android:background="#ffffff">
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_below="@+id/channel_actionbar"
android:layout_marginLeft="0dp"
android:layout_marginTop="0dp"
android:duplicateParentState="true">
<FrameLayout
android:layout_height="match_parent"
android:layout_width="match_parent"
android:id="@+id/body_container"
android:layout_below="@+id/channel_actionbar"
android:duplicateParentState="true">
<RelativeLayout
android:layout_height="match_parent"
android:layout_width="match_parent"
android:id="@+id/channelList"
android:duplicateParentState="true">
<com.mobile.subview.ScrollViewWithScrollListener
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/scrollView"
android:layout_alignParentTop="false"
android:duplicateParentState="true">
<RelativeLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:duplicateParentState="true">
<FrameLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/imagePlaceHolder"
android:duplicateParentState="true"></FrameLayout>
<TableLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/channelTable"
android:layout_below="@+id/imagePlaceHolder"
android:duplicateParentState="true"></TableLayout>
<com.mobile.subview.CustomTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="You do not qualify for any engagements or channels. Please …Run Code Online (Sandbox Code Playgroud) 所以当我调试的时候,我注意到似乎有一个标签在我的应用程序中重复,名为"BubblePopupHelper",带有文本:"isShowingBubblePopup:false"
日志的屏幕截图

据我所知,我没有使用或造成它.有没有人知道发生了什么?应用程序就是我正在编写的应用程序.
经过进一步检查,我注意到每次我更新文本(通过TextView)时都会显示在屏幕上.如果有更好的方法,请告诉我.
谢谢!
我在我的应用程序中使用片段.使用它们时非常常见的问题是使用getActivity()时的NPE.我知道我们可以通过检查是否getActivity() != null每一次或检查片段来解决它isAdded().
在我的一个课程中,我在60多个地方获得了活动的背景.检查getActivity()是否为null或者片段是否仍然添加到所有位置的活动中会使代码变得丑陋,更大且不可维护.有没有其他方法来处理这个?当从活动中删除片段时,甚至可以销毁片段(并在删除时停止它所做的任何工作)?
android nullpointerexception android-fragments android-activity
如果我们在清单中设置android:debuggable = true并且如果我们在iOS中设置android:debuggable = false,是否可以为应用程序设置单独的图标?
在android studio中,当我构建我的项目时,我的事件日志说Compilation completed successfully with 102 warnings in 52 sec.我在哪里可以看到这些编译器警告?我知道Analyze -> Inspect Code哪个不是我想要的.我也尝试使用ant脚本构建我的应用程序
<target name="-warn">
<javac includeantruntime="false" srcdir="src/com/mobile" fork="true" debug="true">
<compilerarg line="-Werror -Xlint:all"/>
</javac>
</target>
Run Code Online (Sandbox Code Playgroud)
这显示了一些警告甚至修复时不会减少编译警告.什么是正确的方法?
我正在尝试在我的应用程序中播放视频,但我得不能播放此视频错误.我遇到了很多相关的问题.他们已经要求在玩家准备好后开始播放视频.我也是这样做的.但无法弄清楚问题.请在下面找到我的代码.
public class Video extends Activity implements MediaPlayer.OnPreparedListener, MediaPlayer.OnErrorListener {
public VideoView vidPlayer;
@Override
protected void onCreate(Bundle savedInstanceState) {
setup();
activateVideoPlayer();
}
public void setup() {
setContentView(R.layout.step_video);
vidPlayer = (VideoView) findViewById(R.id.videoPlayer);
String playableUrl = "http://teststreaming7v.s3.amazonaws.com/public/7515/1374782317346-beagle_puppy_howl_640x360_448_main.mp4";
}
@Override
public void onPrepared(final MediaPlayer mediaPlayer) {
mediaPlayer.setLooping(false);
mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
startPlayer();
videoLoaded = true;
mediaPlayer.setOnBufferingUpdateListener(new MediaPlayer.OnBufferingUpdateListener() {
// show updated information about the buffering progress
public void onBufferingUpdate(MediaPlayer mp, int percent) {
Log.d(this.getClass().getName(), "percent: " + percent);
}
});
mediaPlayer.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
public …Run Code Online (Sandbox Code Playgroud) 我一直在使用CocoaAsyncSocket将数据发送到没有SSL的服务器.现在服务器端已经实现了SSL/TLS和客户端身份验证.为了在我们的应用程序中实现这一点,我得到了以下三个文件:
我将文件转换为iOS可读格式,如下所示:
我已经让它工作到SSL.但是客户端身份验证有问题.
这是我的代码:
didConnectToHost:
- (void)socket:(GCDAsyncSocket *)sock didConnectToHost:(NSString *)host port:(uint16_t)port;
{
// Configure SSL/TLS settings
NSMutableDictionary *settings = [NSMutableDictionary dictionaryWithCapacity:3];
// Allow self-signed certificates
CFArrayRef certsArray = [self loadCertificates];
[settings setObject:@0 forKey:GCDAsyncSocketSSLProtocolVersionMax];
[settings setObject:[NSNumber numberWithBool:YES] forKey:GCDAsyncSocketManuallyEvaluateTrust];
[settings setObject:(id)CFBridgingRelease(certsArray) forKey:GCDAsyncSocketSSLCertificates];
[sock startTLS:settings];
}
Run Code Online (Sandbox Code Playgroud)
didReceiveTrust:
- (void)socket:(GCDAsyncSocket *)sock didReceiveTrust:(SecTrustRef)trust completionHandler:(void (^)(BOOL shouldTrustPeer))completionHandler {
NSString *caCertPath = [[NSBundle mainBundle] pathForResource:@"ca-cert" ofType:@"cer"];
NSData *caCertData = [NSData dataWithContentsOfFile:caCertPath];
NSString *clientCertPath = [[NSBundle mainBundle] pathForResource:@"client_cert" ofType:@"cer"];
NSData …Run Code Online (Sandbox Code Playgroud) 我正在使用SWRevealViewController在我的应用程序中实现两个侧面导航视图.我按照故事板方法成功实现了后视图和前视图.我尝试通过故事板设置与后视图完全相同的正确视图,但是无法做到.
我已将显示视图控制器segue设置为"sw_right",但看起来它没有被- (void)prepareForSegue:(SWRevealViewControllerSegue *)segue sender:(id)sender"sw_rear"和"sw_front"调用两次
我错过了什么?

- (void)prepareForSegue:(SWRevealViewControllerSegue *)segue sender:(id)sender
{
// $ using a custom segue we can get access to the storyboard-loaded rear/front view controllers
// the trick is to define segues of type SWRevealViewControllerSegue on the storyboard
// connecting the SWRevealViewController to the desired front/rear controllers,
// and setting the identifiers to "sw_rear" and "sw_front"
// $ these segues are invoked manually in the loadView method if a storyboard
// was used to …Run Code Online (Sandbox Code Playgroud) 我正在尝试将数据保存在哈希图中并检索它。该键对应的值存在,但仍然返回 null。我还实现了 equals() 和 hashCode() 方法。
ArrayList<Friends> friendsArrayList = new ArrayList<Friends>();
HashMap<Friends,ArrayList<FriendDetails>> friendDetailsHashMap = new HashMap<Friends, ArrayList<FriendDetails>>();
int mSelectedIndex = 0;
...
Friends f = friendsArrayList.get(mSelectedIndex);
ArrayList<MeterGroups> temp2 = friendDetailsHashMap.get(mp); //<== This is where it returns null
Run Code Online (Sandbox Code Playgroud)
我的 ObjectClass Friends.java:
import java.io.Serializable;
public class Friends implements Serializable {
private String friendName;
private String friendId;
private double distanceFromCurrentLocation;
public Friends(String name, String id)
{
this.friendName = name;
this.friendId = id;
this.distanceFromCurrentLocation = getDistanceFromCurrentLocation();
}
public String getFriendName(){
return friendName;
}
public …Run Code Online (Sandbox Code Playgroud) 我开始使用iOS.并使用Storyboard在视图控制器之间导航.第一个屏幕是uiviewcontroller(登录屏幕),第二个屏幕是带有表格视图的uiviewcontroller.我在第一个viewcontroller中发送一些Web请求,然后执行segue到下一个viewcontroller.获得响应后,加载第二个视图控制器有大约9秒的延迟.我尝试使用Timer profiler检查原因,并且没有在我的obj-c代码中找到任何内容.
如果有人可以帮助我这里是我的跟踪文件的链接.
我的日志:
2014-05-08 10:12:12.601 Consumer[6713:4207] One
2014-05-08 10:12:12.602 Consumer[6713:4207] Three
2014-05-08 10:12:12.605 Consumer[6713:4207] Four
2014-05-08 10:12:12.606 Consumer[6713:4207] Two
2014-05-08 10:12:21.394 Consumer[6713:60b] numberOfSectionsInTableView
2014-05-08 10:12:21.395 Consumer[6713:60b] titleForHeaderInSection
2014-05-08 10:12:21.395 Consumer[6713:60b] numberOfRowsInSection
2014-05-08 10:12:21.395 Consumer[6713:60b] titleForHeaderInSection
2014-05-08 10:12:21.395 Consumer[6713:60b] numberOfRowsInSection
2014-05-08 10:12:21.396 Consumer[6713:60b] titleForHeaderInSection
2014-05-08 10:12:21.396 Consumer[6713:60b] numberOfRowsInSection
2014-05-08 10:12:21.396 Consumer[6713:60b] cellForRowAtIndexPath
2014-05-08 10:12:21.399 Consumer[6713:60b] returning cell
2014-05-08 10:12:21.399 Consumer[6713:60b] cellForRowAtIndexPath
2014-05-08 10:12:21.400 Consumer[6713:60b] returning cell
2014-05-08 10:12:21.401 Consumer[6713:60b] cellForRowAtIndexPath
2014-05-08 10:12:21.402 Consumer[6713:60b] returning cell
2014-05-08 10:12:21.402 Consumer[6713:60b] …
我正在尝试开发一种停车应用程序,用户可以在其中支付停放时间.我浏览了有关应用内商品的文档,并对如何付款感到困惑.现在我们计划通过名为"creditcall"的第三方网关进行支付.Google Play会允许吗?