Android Question Download image

RUNO

Active Member
Licensed User
Longtime User
I am trying to download a picture from my site but it gives me this message for show not save

ResponseError. Reason: java.net.UnknownServiceException: CLEARTEXT communication to omxxxxx.com not permitted by network security policy, Response:

Before it was without problems from the free site but when I bought the domain I could not, so is there a difference between free or paid
 

JohnC

Expert
Licensed User
Longtime User
Try adding this line to your manifest:

B4X:
CreateResourceFromFile(Macro, Core.NetworkClearText)
 
Upvote 0

drgottjr

Expert
Licensed User
Longtime User
you have to add this to your manifest: CreateResourceFromFile(Macro, Core.NetworkClearText)
long story, nothing to do with free site or paid domain.
https is the rule. to use http you have to override new device policy with manifest per above. went into effect at sdk 26, i think. maybe 28. anyway, if you're using http, you need to add the above.
 
Upvote 0

RUNO

Active Member
Licensed User
Longtime User
Try adding this line to your manifest:

B4X:
CreateResourceFromFile(Macro, Core.NetworkClearText)

Thank you for helping but after added your code I got this error

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.omj4play/com.omj4play.main}: java.lang.NullPointerException: Attempt to invoke virtual method 'void androidx.appcompat.widget.ContentFrameLayout.setId(int)' on a null object reference
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3114)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3257)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1948)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7050)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:494)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:964)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void androidx.appcompat.widget.ContentFrameLayout.setId(int)' on a null object reference
at androidx.appcompat.app.AppCompatDelegateImpl.createSubDecor(AppCompatDelegateImpl.java:845)
at androidx.appcompat.app.AppCompatDelegateImpl.ensureSubDecor(AppCompatDelegateImpl.java:659)
at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:543)
at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:166)
at com.omj4play.main.onCreate(main.java:62)
at android.app.Activity.performCreate(Activity.java:7327)
at android.app.Activity.performCreate(Activity.java:7318)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1275)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3094)
... 11 more
 
Upvote 0

JohnC

Expert
Licensed User
Longtime User
It looks like your original problem is not happening anymore, but it now looks like you have a different problem with trying to start the "Main" activity.

Please post the code in your Activity_Create of the "Main" activity.

Please use "Insert Code" from the toolbar when you post the code.
 
Upvote 0

RUNO

Active Member
Licensed User
Longtime User
It looks like your original problem is not happening anymore, but it now looks like you have a different problem with trying to start the "Main" activity.

Please post the code in your Activity_Create of the "Main" activity.

Please use "Insert Code" from the toolbar when you post the code.
This is manifest code
When I cancel your code, I don't get the error
CreateResourceFromFile(Macro, Core.NetworkClearText)
B4X:
AddManifestText(
<uses-sdk android:minSdkVersion="7" android:targetSdkVersion="28"/>
<supports-screens android:largeScreens="true"
    android:normalScreens="true"
    android:smallScreens="true"
    android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
'End of default text.

SetApplicationAttribute(android:theme, "@style/MyAppTheme")
'CreateResourceFromFile(Macro, Core.NetworkClearText)

CreateResource(values, theme.xml,
<resources>
    <style name="MyAppTheme" parent="Theme.AppCompat.Light.NoActionBar">
        <item name="colorPrimary">#0098FF</item>
        <item name="colorPrimaryDark">#007CF5</item>
        <item name="colorAccent">#AAAA00</item>
        <item name="windowNoTitle">true</item>
        <item name="windowActionBar">false</item>
    </style>
    <style name="ToolbarMenu" parent="Base.ThemeOverlay.AppCompat.ActionBar">
        <item name="android:textColorPrimary">#fff</item>
        <item name="android:colorBackground">#0098FF</item>
    </style>
</resources>
)
CreateResourceFromFile(Macro, FirebaseAnalytics.GooglePlayBase)
AddApplicationText(
<uses-library
      android:name="org.apache.http.legacy"
      android:required="false" />

<meta-data
  android:name="com.google.android.geo.API_KEY"
  android:value="AIza000000000000000000"/>
)
CreateResourceFromFile(Macro, Core.NetworkClearText)
AddPermission(android.permission.INTERNET)
'End of default text.
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Upvote 0

RUNO

Active Member
Licensed User
Longtime User
I tried to create a small project and compress it but its size is greater than the size allowed on site
The project includes only the main activity, but the size is greater than 10MB and after compressing 4MB the site does not allow
What can I do?
 
Upvote 0

RUNO

Active Member
Licensed User
Longtime User
This is my code in main activity

B4X:
#Region  Activity Attributes
    #FullScreen: False
    #IncludeTitle: True
#End Region
#Extends: android.support.v7.app.AppCompatActivity
Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.
    Private xui As XUI
End Sub

Sub Globals
    'These global variables will be redeclared each time the activity is created.
    Private ACToolBarLight1 As ACToolBarLight
End Sub

Sub Activity_Create(FirstTime As Boolean)
    Activity.LoadLayout("Layout")
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

Sub Button1_Click
    xui.MsgboxAsync("Hello world!", "B4X")
End Sub
 
Upvote 0

JohnC

Expert
Licensed User
Longtime User
Looking at just your code, it looks like there is only one view in the "Layout" - the ACToolBarLight1.

But yet you have a Button1 event, so there must also be a button in the layout.

It looks like you forgot to do a "Generate Members" from the designer for all the views in the layout.
 
Last edited:
Upvote 0

RUNO

Active Member
Licensed User
Longtime User
Looking at just your code, it looks like there is only one view in the "Layout" - the ACToolBarLight1.

But yet you have a Button1 event, so there must also be a button in the layout.

It looks like you forgot to do a "Generate Members" from the designer for all the views in the layout.
I removed the button from code and designer but the problem not from it
 
Upvote 0

JohnC

Expert
Licensed User
Longtime User
What other views do you have in your layout?

Can you send us a screen shot of the layout named "layout" so we can see what views are on it?

I think the problem is, is that you placed views in the layout, but you did not do a "Generate Members" for them, so they are not declared in the code and this is causing a problem with AppCompat.
 
Last edited:
Upvote 0

JohnC

Expert
Licensed User
Longtime User
Since the code you posted is very simple, the only other thing I can think of that could be causing this error is that your SDK setup needs to be redone, but that's just a guess.
 
Upvote 0

RUNO

Active Member
Licensed User
Longtime User
My problem happen if I put this code

B4X:
CreateResourceFromFile(Macro, Core.NetworkClearText)

in manifest & appcompat in project
 
Upvote 0

JohnC

Expert
Licensed User
Longtime User
It looks like your app has at least TWO problems.

The first problem was fixed by adding the line in the manifest.

The second error seems to be caused by you adding appcompat to your project and that is what I am trying to help you with.

Since it sounds like your app at least started without a problem before you added the line in the manifest, then try taking out AppCompat from your project and see if it works ok (but keep the line in the manifest).
 
Last edited:
Upvote 0

RUNO

Active Member
Licensed User
Longtime User
It looks like your app has at least TWO problems.

The first problem was fixed by adding the line in the manifest.

The second error seems to be caused by you adding appcompat to your project and that is what I am trying to help you with.

Since it sounds like your app at least started without a problem before you added the line in the manifest, then try taking out AppCompat from your project and see if it works ok.

Thank you for helping but my project is work without any problem until change domain and add code for fix it in manifest
I need appcompat for cart
 
Upvote 0
Top