我正在尝试为我的项目添加一个库,现在我的当前build.gradle是:
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
repositories {
mavenCentral()
}
defaultConfig {
applicationId "com.example.guycohen.cheaters"
minSdkVersion 11
targetSdkVersion 21
versionCode 1
versionName "1.0"
// Enabling multidex support.
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.facebook.android:facebook-android-sdk:4.0.0'
compile 'com.android.support:multidex:1.0.0'
compile 'com.parse.bolts:bolts-android:1.+'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.whl.handytabbar:library:1.0.4'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.daimajia.easing:library:1.0.1@aar'
compile 'com.daimajia.androidanimations:library:1.1.3@aar'
}
Run Code Online (Sandbox Code Playgroud)
当我添加一个新库
compile 'com.github.navasmdc:PhoneTutorial:1.+@aar'
Run Code Online (Sandbox Code Playgroud)
我收到此错误:
Error:Execution failed for …Run Code Online (Sandbox Code Playgroud) 我之前已经看过这个话题,但我认为这不是同一个场景.我正在尝试通过FCM(Firebase云消息传递)向所有其他设备发送来自一台设备(将成为管理设备)的推送通知,而我正准备通过他们的文档.我试图订阅主题或保持简单仍然得到相同的错误,"MissingRegistration".
String jsonData = "{\"to\":\"/topics/news\",\"notification\":{\"title\":\"title\",\"body\":\"text\" }}";
byte[] postData = jsonData.getBytes(Charset.forName("UTF-8"));
int postDataLength = postData.length;
URL url = new URL("https://fcm.googleapis.com/fcm/send");
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setDoInput(true);
con.setDoOutput(true);
con.setInstanceFollowRedirects(true);
con.setRequestMethod("POST");
con.setRequestProperty("Content-Type","application/json");
con.setRequestProperty("Authorization","key=AIzaSyB70J***-z34q2_h*******qjZsM5zBIf8Y"); //I've added stars :-)
con.setRequestProperty("Content-Type","application/x-www-form-urlencoded");
con.setRequestProperty("Content-Type","charset=UTF-8");
con.setRequestProperty("Content-Length",Integer.toString(postDataLength));
con.setUseCaches(false);
DataOutputStream wr = new DataOutputStream(con.getOutputStream());
wr.write(postData);
InputStream inputStream= con.getInputStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
String line = null;
String outPut = "";
while (((line = reader.readLine()) != null)){
outPut += line;
}
Run Code Online (Sandbox Code Playgroud) android content-type google-api firebase firebase-cloud-messaging
我的MAC 10.9.1上有最新的Mac OS.最新的Xcode版本5.0.2,现在我已经更新到测试版7.1,但出于某种原因,当我尝试在我的设备上测试应用程序时,我收到此消息:
没有配置的iOS设备可用兼容的iOS版本.将iOS设备与最新版本的iOS连接以运行您的应用程序或选择iOS模拟器作为目标.
因此,在检查时Xcode >> window >> organiser,我注意到我的设备变为橙色而不是绿色并且有此消息:
iOS SDK的此安装不支持"Johnny的iPhone"上的iOS版本.请将设备恢复到下面列出的操作系统版本,或更新到最新版本的iOS SDK; 这是可用的
对此有何解决方案?
我似乎无法找到合适的代码.我想在状态栏下放置20个图像(这将是Y)并将其居中(当然这将是X).我可以轻松地使用故事板来完成它,但我正在努力以编程方式进行.我认为这是我的代码:
var image: UIImage = UIImage(named: "someImage.png")!
var bgImage = UIImageView(image: image)
//Tried with self.view.frame.size.height but not working
bgImage.frame = CGRect(x: 0, y: self.view.frame.size.height - 20, width: self.view.frame.size.width, height: 64)
//also tried this which not worked as well
// bgImage.center = CGPointMake(self.view.frame.width, self.view.frame.hight - 20)
self.view.addSubview(bgImage)
Run Code Online (Sandbox Code Playgroud)
我已经搜索了苹果文档,但它很不清楚,任何帮助都会受到赞赏.
我想要实现的应该是非常简单的,但它不起作用.我在我的地图上添加了一个标记,我正试图为它制作一个心跳动画.
我试过以下代码,但没有运气,
ObjectAnimator pulse = ObjectAnimator.ofPropertyValuesHolder(userLocation,
PropertyValuesHolder.ofFloat("scaleX",2f),
PropertyValuesHolder.ofFloat("scaleY",2f)
);
pulse.setDuration(310);
pulse.setRepeatCount(ObjectAnimator.INFINITE);
pulse.setRepeatMode(ObjectAnimator.REVERSE);
pulse.start();
Run Code Online (Sandbox Code Playgroud)
任何建议都会很感激,加上使用外部库也可以是一个选项,我刚刚找不到.
好吧,我的RSS应用程序运行完美,现在我正在尝试使用MBProgressHUD添加一些指标.
我在ViewDidLoad下的View Controller中实现了这段代码
HUD = [[MBProgressHUD alloc] initWithView:self.navigationController.view];
[self.navigationController.view addSubview:HUD];
HUD.labelText = @"Loading";
[HUD show:YES];
Run Code Online (Sandbox Code Playgroud)
到现在为止还挺好.该指标正在发挥作用,但当然永远不会消失.我是新手,我试图在实现文件的某些部分添加到我的[HUD隐藏:是]但是它不起作用.如何在数据加载完成后隐藏指示器?这是我的实现文件.
@implementation ListadoArticulosViewController
- (void)viewDidLoad
{
[super viewDidLoad];
// HUD setting
HUD = [[MBProgressHUD alloc] initWithView:self.navigationController.view];
[self.navigationController.view addSubview:HUD];
HUD.labelText = @"Loading";
[HUD show:YES];
NSURL *feedURL = [NSURL URLWithString:@"http://girlsonlyapp.wordpress.com/feed/"];
feedParser = [[MWFeedParser alloc] initWithFeedURL:feedURL];
feedParser.delegate = self;
feedParser.feedParseType = ParseTypeFull;
feedParser.connectionType = ConnectionTypeAsynchronously;
listadoArticulos = [[NSMutableArray alloc] init];
UIRefreshControl *refreshControl = [[UIRefreshControl alloc] init];
[refreshControl addTarget:self action:@selector(cargaArticulos) forControlEvents:UIControlEventValueChanged];
self.refreshControl = refreshControl;
}
- (void)viewWillAppear:(BOOL)animated {
[super …Run Code Online (Sandbox Code Playgroud) 我正在尝试创建一个单一用途的应用程序。因此,我创建了一个BaseActivity,我所有的活动都继承自它。
看起来像
public class LockDeviceActivity extends AppCompatActivity {
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
private void startLock() {
if(mDevicePolicyManager.isLockTaskPermitted(getPackageName())) {
/**
* If lock task is permitted, we can lock the task. We can use an external DPM like
* TestDPC provided by Google to manage lock task list.
*
* If the lock is obtained using TestDPC, features like status bar, home button, recent
* apps, etc is disabled.
*
* To unlock we can programatically …Run Code Online (Sandbox Code Playgroud) android ×2
xcode ×2
center ×1
content-type ×1
duplicates ×1
firebase ×1
google-api ×1
google-maps ×1
image ×1
ios ×1
kiosk-mode ×1
marker ×1
objective-c ×1
organizer ×1
swift ×1