我在Android Studio 3.4的Build Output控制台中收到以下警告:
任务:app:processDebugResources不建议使用最终值更改属性的值。这将因Gradle 6.0中的错误而失败。
这是我的build.gradle(Module:app)文件:
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.xscoder.myapp"
minSdkVersion 21
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
// Enabling multidex support.
multiDexEnabled true
aaptOptions { cruncherEnabled = false }
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions { javaMaxHeapSize "4g" }
}
repositories {
google()
mavenCentral()
jcenter()
maven { url 'https://jitpack.io' }
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:27.1.1' …Run Code Online (Sandbox Code Playgroud) 我已经尝试了XCode 8 GM种子,我在故事板中发现了一个严重的问题,要么你使用自动布局要么禁用它,Xcode 8搞砸了UIScrollView中包含的UIView,如下所示:
有线的事情是,如果我将嵌入式UIView调整到ScrollView中,退出Xcode并再次打开我的项目,那么UIView会再次变得更大,没有任何意义.
你遇到过同样的问题吗?
你认为苹果公司正式发布XCode 8这个大错误吗?
谢谢!
更新 不幸的是,即使是正式版的Xcode 8也有同样的问题:(
自从我更新到Android Studio 3.1后,我的项目就不再运行了.我在互联网上搜索了一个解决方案,没有任何积极的结果.这是我在Logcat中得到的错误:
--------- beginning of crash
04-13 13:33:55.466 12720-12720/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: woopy.domain.com.woopy, PID: 12720
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/common/internal/zzbq;
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source:2)
at android.app.ActivityThread.installProvider(ActivityThread.java:6239)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:5805)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5722)
at android.app.ActivityThread.-wrap1(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1656)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.common.internal.zzbq" on path: DexPathList[[zip file "/data/app/woopy.domain.com.woopy-KqNv1gE1ZomaesHCq33DJw==/base.apk"],nativeLibraryDirectories=[/data/app/woopy.domain.com.woopy-KqNv1gE1ZomaesHCq33DJw==/lib/x86, /system/lib, /vendor/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:125)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source:2)
at android.app.ActivityThread.installProvider(ActivityThread.java:6239)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:5805)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5722)
at …Run Code Online (Sandbox Code Playgroud) 我不喜欢XCode的测试版; 我确实想尝试一下XCode 8.然而,我遇到的一个奇怪的问题是,一旦我打开我的7.3项目,故事板将我的所有视图放大到右侧的ScrollView - 如下面的屏幕截图所示:
我不使用Autolayout,因为大部分时间我都将我的观点设置在特定的位置.
包含这两个控制器的ScrollView是320,因此它不会调整大小,只调整其中的视图.
您认为XCode 8的发布版本能解决这个问题吗?
或者你遇到过同样的问题?
谢谢!
FirebaseMessagingService当我收到推送通知并且应用程序位于前台时,我有以下工作正常:
public class _FCMService extends FirebaseMessagingService {
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
if (remoteMessage.getData().size() > 0) {
// Log.i(TAG, "PUSH PAYLOAD: " + remoteMessage.getData());
JSONObject pushData = new JSONObject(remoteMessage.getData());
pushType = pushData.optString("pushType");
pushMessage = pushData.optString("body");
Log.i(TAG, "ON PUSH RECEIVED - pushType: " + pushType);
Log.i(TAG, "ON PUSH RECEIVED - pushMessage: " + pushMessage);
Uri defaultSoundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this)
.setContentText(pushMessage)
.setStyle(new NotificationCompat.BigTextStyle())
.setAutoCancel(true)
.setSmallIcon(R.mipmap.ic_launcher)
.setSound(defaultSoundUri);
NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
assert notificationManager != null;
notificationManager.notify(0 …Run Code Online (Sandbox Code Playgroud) java android push-notification android-notifications firebase-cloud-messaging
我已经在 Steam 上上传了 2 个版本,一个用于 macOS,一个用于 Windows,但 Depot 部分如下所示:
这是我的构建设置:
这是我的 Depot 设置:
我不知道如何完成仪表板中的仓库清单。我已阅读官方文档,但没有找到任何帮助。
我有以下代码:
print("CODE STRING SELECTED: \(codeString)")
let aURL = URL(string: codeString)!
if UIApplication.shared.canOpenURL(aURL) { UIApplication.shared.openURL(aURL) }
Run Code Online (Sandbox Code Playgroud)
此代码位于 Button 内,Xcode 控制台codeString正确打印,但事实并非如此,nil因此它应该打开 的 URL codeString,相反,Xcode 会抛出此错误:
CODE STRING SELECTED: mailto:john@doe.com?subject=Subject here&body=Lorem ipsum dolor sit, amet quatum.
Fatal error: Unexpectedly found nil while unwrapping an Optional value
2019-07-08 11:19:56.076467+0200 QRcode[2751:1043394] Fatal error: Unexpectedly found nil while unwrapping an Optional value
Run Code Online (Sandbox Code Playgroud)
如果是电话号码或短信字符串,也会发生同样的情况(我codeString从扫描的二维码中获取值):
CODE STRING SELECTED: tel:+1 2345678901
Fatal error: Unexpectedly found nil while unwrapping an Optional value
CODE …Run Code Online (Sandbox Code Playgroud) 我正在尝试将文件上传(在本例中我正在尝试使用图像,但我需要能够上传任何类型的文件,尤其是视频文件)到我的服务器。
这是我的 PHP 代码,它在服务器端运行良好:
<?php include '_config.php';
if ($_FILES["file"]["error"] > 0) {
echo "Error: " .$_FILES["file"]["error"]. "<br>";
} else {
// Check file size
if ($_FILES["file"]["size"] > 20485760) { // 20 MB
echo "ERROR: Your file is larger than 20 MB. Please upload a smaller one.";
} else { uploadImage(); }
}// ./ If
// UPLOAD IMAGE ------------------------------------------
function uploadImage() {
// generate a unique random string
$randomStr = generateRandomString();
$filePath = "uploads/".$randomStr;
// upload image into the 'uploads' folder …Run Code Online (Sandbox Code Playgroud) 我无法获得editedVideoPath的完整NSURL,这是我的代码:
// GLOBAL VARIABLES
var videoPath = String()
var videoURL = NSURL()
// Video Editor delegate
func videoEditorController(editor: UIVideoEditorController, didSaveEditedVideoToPath editedVideoPath: String) {
if saveToPhotoLibrary {
if UIVideoAtPathIsCompatibleWithSavedPhotosAlbum(editedVideoPath) {
UISaveVideoAtPathToSavedPhotosAlbum(editedVideoPath, self, nil, nil)
}
print("SAVED TO PHOTO LIBRARY AT: \(editedVideoPath)")
}
videoPath = editedVideoPath
videoURL = NSURL(string: editedVideoPath)!
print("VIDEO PATH: \(videoPath)")
print("VIDEO URL: \(videoURL)")
dismissViewControllerAnimated(true, completion: nil)
}
Run Code Online (Sandbox Code Playgroud)
问题是我无法从videoPath字符串中获取完整的NSURL ,这是XCode控制台输出的内容:
VIDEO PATH: /private/var/mobile/Containers/Data/Application/D7536AD4-353A-48CA-8F31-2D78F9F10730/tmp/trim.BFF7D20F-138A-46A2-A58E-76736AF7343E.MOV
VIDEO URL: /private/var/mobile/Containers/Data/Application/D7536AD4-353A-48CA-8F31-2D78F9F10730/tmp/trim.BFF7D20F-138A-46A2-A58E-76 ... 343E.MOV
Run Code Online (Sandbox Code Playgroud)
如您所见,VIDEO URL几乎在其末尾获得点,而VideoPath字符串是正确的。这是一个非常有线的问题,我从未在此NSURL语句中遇到过:
videoURL = NSURL(string: editedVideoPath)!
Run Code Online (Sandbox Code Playgroud)
由于我需要将编辑后的视频上传到Web服务器,因此需要完整的正确URL。我以为是print()的问题,但是如果我尝试抓住videoURL, …
我刚刚更新到Xcode 9.0正式版,当我运行使用位置服务的应用程序时,它工作正常但控制台打印出以下警告:
The app's Info.plist must contain both NSLocationAlwaysAndWhenInUseUsageDescription and NSLocationWhenInUseUsageDescription keys with string values explaining to the user how the app uses this data
Run Code Online (Sandbox Code Playgroud)
所以我试图在我的Info.plist中添加以下密钥:
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>This app needs your current location</string>
Run Code Online (Sandbox Code Playgroud)
但是当我再次尝试运行应用时,Xcode 9会显示一条警告:无法读取数据,因为数据格式不正确.
所以我切换回:
<key>NSLocationAlwaysUsageDescription</key>
Run Code Online (Sandbox Code Playgroud)
该应用程序工作正常.哦,我的Info.plist已经包含了NSLocationWhenInUseUsageDescription键!
这是控制台中的Xcode 9错误吗?有人得到同样的警告吗?
我有一个简单的应用程序,我以这种方式从存储在我自己的服务器中的 JSON 文件获取数据 - 我正在使用SwiftyJSON:
func queryData(_ fileName:String) {
guard let url = URL(string: JSON_PATH + fileName + ".json") else {return} // JSON_PATH + fileName + ".json" is the complete path to my db.json file (see below)
let task = URLSession.shared.dataTask(with: url) { (data, response, error) in
guard let dataResponse = data, error == nil else {
self.simpleAlert(error!.localizedDescription)
return
}
let jsonData = try! JSON(data: dataResponse)
print("ARRAY: \(jsonData)")
}
task.resume()
}
Run Code Online (Sandbox Code Playgroud)
这是我的db.json文件:
[
{
"objID":"GNoW3vszYz",
"string":"First …Run Code Online (Sandbox Code Playgroud)